File tree 1 file changed +36
-3
lines changed
1 file changed +36
-3
lines changed Original file line number Diff line number Diff line change 1
- name : Generate TOC on PR Merge
1
+ name : Generate TOC on PR Merge or Push
2
2
3
3
on :
4
+ # Trigger on PR merge
4
5
pull_request_target :
5
6
types :
6
7
- closed
7
8
branches :
8
9
- main
10
+ # Trigger on direct pushes to main branch
11
+ push :
12
+ branches :
13
+ - main
9
14
10
15
jobs :
11
- if_merged :
12
- if : github.event.pull_request.merged == true
16
+ build_toc_on_pr_merge :
17
+ if : github.event_name == 'pull_request_target' && github.event.pull_request.merged == true
18
+ runs-on : ubuntu-latest
19
+ steps :
20
+ - name : Checkout repository
21
+ uses : actions/checkout@v3
22
+
23
+ - name : Set up Python 3
24
+ uses : actions/setup-python@v3
25
+ with :
26
+ python-version : ' 3.x'
27
+
28
+ - name : Run TOC generation script
29
+ run : |
30
+ chmod +x .scripts/idxtool.py
31
+ python3 .scripts/idxtool.py --toc
32
+
33
+ - name : Commit TOC updates
34
+ run : |
35
+ git config --global user.name 'LouisShark'
36
+ git config --global user.email '[email protected] '
37
+ git add .
38
+ git commit -m "docs: Update TOC.md" || echo "No changes to commit"
39
+ git pull --rebase
40
+ git push origin HEAD:main
41
+ env :
42
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43
+
44
+ build_toc_on_push :
45
+ if : github.event_name == 'push'
13
46
runs-on : ubuntu-latest
14
47
steps :
15
48
- name : Checkout repository
You can’t perform that action at this time.
0 commit comments