.github/workflows/update.yml #143
This file contains hidden or 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
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # Give the default GITHUB_TOKEN write permission to commit and push the | |
| # added or changed files to the repository. | |
| contents: write | |
| steps: | |
| - name: Cache Repositories | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }} | |
| key: ${{ runner.os }}-workspace | |
| - name: Checkout Data Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} | |
| repository: ${{ github.repository }} | |
| path: ./data | |
| - name: Checkout Action Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} | |
| repository: ust-archive/ust-course-catalog-action | |
| path: ./action | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Run Update | |
| run: | | |
| cd ./action | |
| bun run run | |
| - name: Setup Commit This | |
| run: | | |
| cd ./data | |
| cp ../action/course-catalog.json ./ | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "UST Rankings Bot" | |
| git add . | |
| - name: Commit This | |
| continue-on-error: true | |
| run: | | |
| cd ./data | |
| now=$(TZ=Asia/Hong_Kong date +"%Y-%m-%d") | |
| git commit -a -m "update: $now" | |
| - name: Push This | |
| uses: ad-m/github-push-action@master | |
| with: | |
| directory: ./data |