PETA Cron Job #492
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: PETA Cron Job | |
on: | |
schedule: | |
- cron: '0 1 * * *' | |
workflow_dispatch: | |
jobs: | |
fetch-and-save: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo on main branch | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.17' | |
- name: Install dependencies | |
run: npm install axios cheerio qs jsdom | |
- name: Fetch PETA Data and Save | |
run: node ${{ github.workspace }}/.github/scripts/peta-cron.js | |
- name: Commit and push if there are changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add peta_cruelty_free.json | |
git commit -m "Update peta_cruelty_free.json" || echo "No changes to commit" | |
git push origin main --force |