Update Route Data #1016
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: Update Route Data | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 22 * * *' | |
jobs: | |
update: | |
name: Update Route Data | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node env | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
# http://man7.org/linux/man-pages/man1/date.1.html | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache Stop data | |
uses: actions/cache/restore@v4 | |
with: | |
path: cache | |
key: stop-data-${{ steps.get-date.outputs.date }} | |
restore-keys: stop-data | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Update Route Data | |
run: | | |
npm run update-route | |
- name: Generate sitemap | |
run: | | |
npm run generate-sitemap | |
- name: Commit and Push data | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Update Route data | |
file_pattern: 'public/api/route/**' | |
commit_author: Actions <github-actions[bot]@users.noreply.github.com> | |
- name: Update Stop Name on exception | |
if: failure() && env.runUpdateStopName == 'true' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: gh workflow run updateStopName.yml -f reRunId=$GITHUB_RUN_ID |