Skip to content

Commit 5d9a7b3

Browse files
authored
Replace the_od_bods data on pipeline run (#3)
* added commit action for /data in the_od_bods and reduced pipeline to test * attempt 2 with tokens * restored full pipeline * fix: add changes requested in review. Reduced code for testing. * restored full pipeline
1 parent 3a7d4a1 commit 5d9a7b3

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

.github/workflows/pipeline.yml

+21-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99
default: true
1010
type: boolean
11-
commitToSite:
11+
commitToRepos:
1212
description: 'Commit to opendata.scot'
1313
required: true
1414
default: true
@@ -31,6 +31,7 @@ jobs:
3131
with:
3232
repository: 'OpenDataScotland/the_od_bods'
3333
path: 'the_od_bods'
34+
token: ${{ secrets.REPO_COMMIT_TOKEN }}
3435
- name: Check out JKAN repo
3536
uses: actions/checkout@v3
3637
with:
@@ -72,12 +73,12 @@ jobs:
7273
# USMART portals
7374
- name: Run Script usmart.py
7475
run: python ./usmart.py
75-
working-directory: ${{env.odbodsPath}}
76-
76+
working-directory: ${{env.odbodsPath}}
77+
7778
- name: Run Script ckan.py
7879
run: python ./ckan.py
7980
working-directory: ${{env.odbodsPath}}
80-
81+
8182
# ScotGov Statistics Sparkql
8283
- name: Run Script sparkql_statistics.py
8384
run: python ./sparkql_statistics.py
@@ -102,12 +103,12 @@ jobs:
102103
- name: Run Script moray_council_scraper.py
103104
run: python ./moray_council_scraper.py
104105
working-directory: ${{env.odbodsPath}}/web-scrapers
105-
106+
106107
# National Library of Scotland feeds
107108
- name: Run Script nls_scraper.py
108109
run: python ./nls_scraper.py
109110
working-directory: ${{env.odbodsPath}}/web-scrapers
110-
111+
111112
# Merge data
112113
- name: Run Script merge_data.py
113114
run: python ./merge_data.py
@@ -122,15 +123,22 @@ jobs:
122123
- name: Git config
123124
working-directory: ${{env.jkanPath}}
124125
run: |
125-
git config user.name "GitHub Actions"
126-
git config user.email "<>"
127-
- name: Git status
126+
git config --global user.name 'github-actions[bot]'
127+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
128+
- name: Git status JKAN
128129
run: git status
129130
working-directory: ${{env.jkanPath}}
130-
- name: Commit and push
131-
if: ${{ github.event.inputs.commitToSite == 'true' || github.event.schedule == '0 12 * * FRI' }}
132-
run: git add -A && git commit -m "Dataset Sync" && git push origin gh-pages
131+
- name: Commit and push JKAN
132+
if: ${{ github.event.inputs.commitToRepos == 'true' || github.event.schedule == '0 12 * * FRI' }}
133+
run: git add -A && git commit -m 'Dataset Sync' && git push origin gh-pages
133134
working-directory: ${{env.jkanPath}}
135+
- name: Git status the_od_bods
136+
run: git status
137+
working-directory: ${{env.odbodsPath}}
138+
- name: Commit and push the_od_bods
139+
if: ${{ github.event.inputs.commitToRepos == 'true' || github.event.schedule == '0 12 * * FRI' }}
140+
run: git add data && git commit -m "Dataset Sync" && git push origin main
141+
working-directory: ${{env.odbodsPath}}
134142

135143
# Tell the Slack channel!
136144
- name: Slack Notification
@@ -149,7 +157,7 @@ jobs:
149157
150158
# Debugging: artifact upload if the workflow fails at all or if we're not committing to the site (likely to debug)
151159
- uses: actions/upload-artifact@v3
152-
if: ${{ failure() || github.event.inputs.commitToSite == 'false' }}
160+
if: ${{ failure() || github.event.inputs.commitToRepos == 'false' }}
153161
with:
154162
name: workspace
155163
path: ${{ github.workspace }}

0 commit comments

Comments
 (0)