mirror of
https://github.com/eunomia-bpf/bpf-developer-tutorial.git
synced 2026-02-02 17:59:47 +08:00
feat: add workflow for auto-generating documentation on push
This commit is contained in:
45
.github/workflows/auto-generate-docs.yml
vendored
Normal file
45
.github/workflows/auto-generate-docs.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Auto Generate Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**/README.md'
|
||||
- 'src/**/README.zh.md'
|
||||
- 'src/**/.config'
|
||||
- 'scripts/generate_toc.py'
|
||||
- 'scripts/*.template'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
generate-docs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Generate documentation
|
||||
run: |
|
||||
python3 scripts/generate_toc.py
|
||||
|
||||
- name: Check for changes
|
||||
id: check_changes
|
||||
run: |
|
||||
git diff --quiet || echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit and push changes
|
||||
if: steps.check_changes.outputs.has_changes == 'true'
|
||||
run: |
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add README.md README.zh.md src/SUMMARY.md src/SUMMARY.zh.md
|
||||
git commit -m "docs: auto-generate documentation"
|
||||
git push
|
||||
Reference in New Issue
Block a user