Update Static Files #452
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: Update Static Files | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 12 * * 1-5' | |
jobs: | |
UpdateXKCDData: | |
name: Update XKCD Data | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SKYRA_TOKEN }} | |
- name: Use Node.js v22 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: yarn | |
- name: Install Dependencies | |
run: yarn --immutable | |
- name: Run the XKCD Extraction script | |
run: yarn scripts:update-xkcd-entries | |
- name: Run the WhatIf Extraction script | |
run: yarn scripts:update-what-if-entries | |
- name: Commit any changes and push code | |
env: | |
GITHUB_USER: github-actions[bot] | |
GITHUB_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git add .; | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit, exiting with code 0" | |
exit 0; | |
else | |
git remote set-url origin "https://${GITHUB_TOKEN}:x-oauth-basic@github.com/${GITHUB_REPOSITORY}.git"; | |
git config --local user.email "${GITHUB_EMAIL}"; | |
git config --local user.name "${GITHUB_USER}"; | |
git commit -sam "refactor: update xkcd data"; | |
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD); | |
fi |