.github/workflows/update.yml #339
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
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
name: main | |
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 This | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.UST_RANKINGS_DATA_TOKEN }} | |
repository: ${{ github.repository }} | |
fetch-depth: 0 | |
path: '.' | |
- name: Checkout Review | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.UST_RANKINGS_DATA_TOKEN }} | |
repository: ust-archive/ust.space-data | |
fetch-depth: 1 | |
path: './data-review' | |
- name: Checkout Quota | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.UST_RANKINGS_DATA_TOKEN }} | |
repository: ust-archive/ust-cq | |
fetch-depth: 1 | |
path: './data-cq' | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Install Dependencies | |
run: | | |
pnpm install --frozen-lockfile | |
- name: Run Update | |
run: | | |
pnpm run run | |
- name: Setup Commit This | |
run: | | |
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: | | |
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: ${{ github.workspace }} |