Daily database sync #298
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: Daily database sync | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Fetch records | |
run: | | |
export SHEETS_ID=${{ secrets.SHEETS_ID }} | |
export SHEETS_API_KEY=${{ secrets.SHEETS_API_KEY }} | |
export SHEETS_NAME=${{ secrets.SHEETS_NAME }} | |
pnpm sync-data | |
- name: Push updated database | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: data | |
message: Update database `date +'%Y-%m-%d'` | |
committer_name: GitHub Actions | |
committer_email: 41898282+github-actions[bot]@users.noreply.github.com |