Schedule update Contentful data & sitemap #368
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: Schedule update Contentful data & sitemap | |
on: | |
schedule: | |
- cron: '0 15 * * *' | |
jobs: | |
fetch-data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: release | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Fetch Contentful data | |
run: SPACE_ID=${{secrets.CONTENTFUL_SPACE_ID}} ACCESS_TOKEN=${{secrets.CONTENTFUL_ACCESS_TOKEN}} node ./contentful.js | |
- name: Update sitemap | |
run: node ./sitemap.js | |
- name: Commit to GitHub | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git add app/_assets/contentfulEntries.json | |
git add public/sitemap.txt | |
git commit -m "Update Contentful data & sitemap" || echo "Nothing to commit" | |
git push --no-verify |