Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# YAML data changes need maintainer approval.
site/_data/*.yml @sshkhr @gmberton @smsnobin77

# Workflow and script changes need maintainer approval.
.github/workflows/* @sshkhr @gmberton @smsnobin77
scripts/* @sshkhr @gmberton @smsnobin77

# README.md is auto-managed — no code-owner review required, so the bot PR can merge.
65 changes: 22 additions & 43 deletions .github/workflows/diff-readme-on-pr.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,40 @@
name: Update README (pull_request)
name: README preview (PR)

on:
pull_request_target:
pull_request:
paths:
- 'site/_data/summerschools.yml'
workflow_dispatch:

permissions:
pull-requests: write
contents: read

jobs:
update-readme-pr:
render-preview:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4

- name: Fetch master
run: git fetch origin master:master

- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.11'

- name: Install dependencies
run: |
pip install pyyaml python-dateutil
- run: pip install pyyaml python-dateutil ruamel.yaml

- name: Update README locally (no commit)
id: update_readme
run: |
python scripts/update_readme.py
git diff README.md > diff.txt
- name: Render preview
run: python scripts/pr_preview.py --output preview.md

# Expose the diff as an output
echo "diff<<EOF" >> $GITHUB_OUTPUT
cat diff.txt | sed 's/%/%25/g; s/\n/%0A/g; s/\r/%0D/g' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Save PR number
run: echo "${{ github.event.pull_request.number }}" > pr-number.txt

- name: Comment on PR with diff
uses: actions/github-script@v6
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
diff: ${{ steps.update_readme.outputs.diff }}
script: |
const diff = core.getInput('diff');
if (!diff.trim()) {
core.info("No changes in README.md.");
return;
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `**Proposed changes in README.md**\n\`\`\`diff\n${diff}\n\`\`\``
});
env:
diff: ${{ steps.update_readme.outputs.diff }}
name: readme-preview
path: |
preview.md
pr-number.txt
52 changes: 52 additions & 0 deletions .github/workflows/post-pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Post README preview comment

on:
workflow_run:
workflows: ['README preview (PR)']
types: [completed]

permissions:
pull-requests: write

jobs:
post-comment:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download preview artifact
uses: actions/download-artifact@v4
with:
name: readme-preview
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
path: ./preview

- name: Read PR number
id: pr
run: |
number=$(cat ./preview/pr-number.txt)
echo "number=$number" >> "$GITHUB_OUTPUT"

- name: Read preview body
id: body
run: |
{
echo 'body<<PREVIEW_EOF'
cat ./preview/preview.md
echo 'PREVIEW_EOF'
} >> "$GITHUB_OUTPUT"

- name: Find existing preview comment
uses: peter-evans/find-comment@v3
id: find
with:
issue-number: ${{ steps.pr.outputs.number }}
body-includes: '<!-- readme-preview-bot -->'

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.pr.outputs.number }}
comment-id: ${{ steps.find.outputs.comment-id }}
body: ${{ steps.body.outputs.body }}
edit-mode: replace
38 changes: 0 additions & 38 deletions .github/workflows/update-readme-on-push.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Update README (auto)

on:
schedule:
- cron: '0 6 * * *' # 06:00 UTC daily
push:
branches: [master]
paths:
- 'site/_data/summerschools.yml'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_PR_TOKEN }}
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- run: pip install pyyaml python-dateutil ruamel.yaml

- name: Render README
run: python scripts/update_readme.py

- name: Detect changes
id: diff
run: |
if git diff --quiet README.md; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Create or update PR
if: steps.diff.outputs.changed == 'true'
id: cpr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.BOT_PR_TOKEN }}
branch: bot/readme-update
base: master
title: "chore: auto-update README (${{ github.run_started_at }})"
commit-message: "chore: auto-update README"
body: |
Automated README refresh.

This PR is kept in sync by the `update-readme` workflow and auto-merges when checks pass.
add-paths: README.md
delete-branch: true

- name: Enable auto-merge
if: steps.cpr.outputs.pull-request-number
run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ secrets.BOT_PR_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/validate-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: validate-readme

on:
pull_request:

permissions:
contents: read

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- run: pip install pyyaml python-dateutil ruamel.yaml

- name: Validate YAML schema + renderer
run: python scripts/validate_readme.py
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
**/.DS_Store
site/_site/*
site/_site/*
docs/*
CLAUDE.local.md
**/__pycache__/
.pytest_cache/
Loading
Loading