refresh-data #571
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: refresh-data | |
on: | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: {} | |
push: | |
paths: | |
- .github/workflows/refresh-data.yml | |
- scripts/refreshDentists.mjs | |
env: | |
GIT_TERMINAL_PROMPT: 0 | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "14" | |
- run: npm install | |
- name: Refresh data | |
run: npm run refresh-data | |
env: | |
NHSDIGITAL_ODATA_ENDPOINT: https://api.nhs.uk/ | |
NHSDIGITAL_ODATA_SUBSCRIPTION_KEY: ${{ secrets.NHSDIGITAL_ODATA_SUBSCRIPTION_KEY }} | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v9 | |
id: verify-changed-files | |
with: | |
files: data/**/*.json | |
- name: Commit changes | |
if: contains(steps.verify-changed-files.outputs.changed_files, 'data/') | |
run: | | |
git config --global user.name 'Dentists (automated)' | |
git config --global user.email '[email protected]' | |
git add ${{ steps.verify-changed-files.outputs.changed_files }} | |
git commit -n -m "Regenerate data from NHS API" | |
git push |