Skip to content

Update Schoolwork README #18

Update Schoolwork README

Update Schoolwork README #18

Workflow file for this run

name: Update Schoolwork README
on:
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
jobs:
update-readme:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install requests
- name: Generate README
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_NAME: gainsborourse
run: python scripts/generate.py
- name: Check for changes
id: changes
run: |
if git diff --quiet -- README.md; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit README
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
SHA=$(gh api repos/${{ github.repository }}/contents/README.md --jq .sha)
CONTENT=$(base64 < README.md | tr -d '\n')
gh api repos/${{ github.repository }}/contents/README.md \
-X PUT \
-f message='chore: regenerate coursework README' \
-f content="$CONTENT" \
-f sha="$SHA"