Skip to content

Merge pull request #111 from MaxFork/max-updates-improve #1

Merge pull request #111 from MaxFork/max-updates-improve

Merge pull request #111 from MaxFork/max-updates-improve #1

name: Render HTML on Changes
on:
push:
branches:
- main
paths:
- '**.py'
- 'layouts/**'
- 'docs/styles.css'
- 'docs/script.js'
pull_request:
types: [closed]
workflow_dispatch:
jobs:
render-html:
if: github.event_name != 'pull_request' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout main branch
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Run render.py
run: python render.py
- name: Check for changes
id: changes
run: |
if git diff --quiet docs/index.html; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.changes.outputs.has_changes == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/index.html
if [ "${{ github.event_name }}" == "pull_request" ]; then
git commit -m "chore: render HTML from merged PR"
else
git commit -m "chore: render HTML after code changes"
fi
git push origin main