Skip to content

Update workflow to trigger on push to master branch #39

Update workflow to trigger on push to master branch

Update workflow to trigger on push to master branch #39

Workflow file for this run

name: Update README and Create PR
on:
push:
branches:
- master
pull_request:
types: [closed]
branches:
- master
jobs:
update-readme:
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'pull_request' && github.event.pull_request.merged == true)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: master
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Run makeindex.py
run: python3 .github/workflows/makeindex.py
- name: Check for changes
id: check_changes
run: |
if git diff --quiet; then
echo "No changes detected"
echo "changes_detected=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "changes_detected=true" >> $GITHUB_OUTPUT
fi
- name: Commit README.md updates
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git checkout -b update-readme-${{ github.run_number }}
git add WAIC-TEST/HTML/README.md
git commit -m "Update README.md automatically"
git push origin update-readme-${{ github.run_number }}
- name: Create Pull Request
if: steps.check_changes.outputs.changes_detected == 'true'
uses: peter-evans/create-pull-request@v7
with:
branch: update-readme-${{ github.run_number }}
commit-message: "Update README.md automatically"
title: "Automatically update README.md"
body: "This is an auto-generated PR to update README.md file"
base: master