-
Notifications
You must be signed in to change notification settings - Fork 14
69 lines (60 loc) · 2.07 KB
/
reusable-update-date.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
on:
workflow_call:
inputs:
city:
description: "Country/City"
required: true
type: string
jobs:
update-data:
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: update-${{ inputs.city }}
cancel-in-progress: true
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/equalstreetnames
token: ${{ steps.app-token.outputs.token }}
submodules: true
- name: Validate composer.json and composer.lock
working-directory: process
run: composer validate
- name: Install dependencies
working-directory: process
run: composer install --prefer-dist --no-progress
- name: Checkout submodule to master
working-directory: cities/${{ inputs.city }}
run: git checkout -q master
- name: Update sub-modules
run: git submodule update --remote --merge cities/${{ inputs.city }}
- name: Normalize `data.csv` file
working-directory: process
run: php process.php tool:normalize-csv --city=${{ inputs.city }}
- name: Run update
working-directory: process
run: composer run update-data -- --city=${{ inputs.city }}
- name: Git configuration
run: |
git config --global user.name github-actions[bot]
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Commit & Push sub-module
working-directory: cities/${{ inputs.city }}
run: |
git add -A
git commit -m "🗃 Update data"
git push
- name: Commit & Push main repository
run: |
git pull
git add cities/${{ inputs.city }}
git commit -m "🗃 Update ${{ inputs.city }} sub-module"
git push