Skip to content

Refresh site from GitHub API #8

Refresh site from GitHub API

Refresh site from GitHub API #8

Workflow file for this run

name: Refresh site from GitHub API
on:
# Run daily at 06:13 UTC to pick up new repos / changed metadata.
schedule:
- cron: "13 6 * * *"
# Run on demand from the Actions tab.
workflow_dispatch:
# Run whenever site.json changes (manual curation).
push:
paths:
- "site.json"
- "templates/**"
- "scripts/**"
permissions:
contents: write
jobs:
refresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build index.html
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python scripts/build.py
- name: Check for changes
id: diff
run: |
if git diff --quiet index.html; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit refreshed index.html
if: steps.diff.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add index.html
git commit -m "chore: refresh index.html from GitHub API"
git push