Merge pull request #240 from waic/add-test-0092-01 #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update README and Create PR | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
update-readme: | |
if: 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 "[email protected]" | |
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@v3 | |
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 |