mirror of
https://github.com/LouisShark/chatgpt_system_prompt.git
synced 2025-07-05 06:10:28 -04:00
docs: enhance TOC generation workflow to trigger on push events
This commit is contained in:
parent
9bc4e72173
commit
44af260493
1 changed files with 36 additions and 3 deletions
39
.github/workflows/build-toc.yaml
vendored
39
.github/workflows/build-toc.yaml
vendored
|
@ -1,15 +1,48 @@
|
||||||
name: Generate TOC on PR Merge
|
name: Generate TOC on PR Merge or Push
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
# Trigger on PR merge
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types:
|
types:
|
||||||
- closed
|
- closed
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
# Trigger on direct pushes to main branch
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
if_merged:
|
build_toc_on_pr_merge:
|
||||||
if: github.event.pull_request.merged == true
|
if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Python 3
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Run TOC generation script
|
||||||
|
run: |
|
||||||
|
chmod +x .scripts/idxtool.py
|
||||||
|
python3 .scripts/idxtool.py --toc
|
||||||
|
|
||||||
|
- name: Commit TOC updates
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'LouisShark'
|
||||||
|
git config --global user.email 'mshark.louis@gmail.com'
|
||||||
|
git add .
|
||||||
|
git commit -m "docs: Update TOC.md" || echo "No changes to commit"
|
||||||
|
git pull --rebase
|
||||||
|
git push origin HEAD:main
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
build_toc_on_push:
|
||||||
|
if: github.event_name == 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue