-
Notifications
You must be signed in to change notification settings - Fork 4
59 lines (52 loc) · 1.78 KB
/
update-readme.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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