1- name : Documentation Automation
1+ name : Docs Autopilot (push)
22on :
33 push :
44 branches : ["main", "develop"]
5- pull_request :
6- branches : ["main"]
5+ paths :
6+ - " server/**"
7+ - " web/**"
8+ - " scripts/docs_ai/**"
9+ - " data/models.json"
10+ - " data/glossary.json"
11+ - " docker-compose.yml"
12+ - " pyproject.toml"
13+ - " tribrid_config.json"
14+ - " start.sh"
715 workflow_dispatch :
816 inputs :
9- regenerate_all :
10- description : ' Regenerate all documentation '
17+ base_ref :
18+ description : " Base ref to diff against (default: previous push SHA) "
1119 required : false
12- type : boolean
13- default : false
20+ default : " "
1421
1522permissions :
1623 contents : write
17- pages : write
18- id-token : write
19- pull-requests : write
2024
2125jobs :
22- generate-docs :
26+ docs-autopilot :
27+ if : github.actor != 'github-actions[bot]'
2328 runs-on : ubuntu-latest
2429 steps :
2530 - uses : actions/checkout@v4
2631 with :
2732 fetch-depth : 0
33+ ref : ${{ github.ref }}
2834
2935 - name : Set up Python
3036 uses : actions/setup-python@v5
@@ -34,75 +40,36 @@ jobs:
3440 - name : Install dependencies
3541 run : |
3642 python -m pip install --upgrade pip
43+ pip install requests
3744 pip install mkdocs==1.6.1 mkdocs-material==9.7.1 pymdown-extensions==10.7.1
3845 pip install mike==2.1.0 mkdocs-git-revision-date-localized-plugin==1.2.6 mkdocs-minify-plugin==0.8.0
3946 pip install mkdocs-glightbox
40- pip install requests pyyaml openai
4147
42- - name : Generate documentation with AI
43- if : ${{ github.event.inputs.regenerate_all == 'true' }}
48+ - name : Generate docs patch (apply)
4449 env :
4550 OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
51+ OPENAI_MODEL : gpt-5
4652 run : |
47- python scripts/docs_ai/docs_autopilot_enhanced.py --regenerate-all
53+ BASE="${{ github.event.inputs.base_ref }}"
54+ if [ -z "$BASE" ]; then
55+ BASE="${{ github.event.before }}"
56+ fi
57+ if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
58+ BASE="origin/${{ github.ref_name }}"
59+ fi
60+ echo "Using base ref: $BASE"
61+ python scripts/docs_ai/generate_docs_from_diff.py --base "$BASE" --llm openai --apply
4862
4963 - name : Build documentation
5064 run : mkdocs build --strict
5165
52- - name : Create PR with documentation updates
53- if : github.event_name == 'workflow_dispatch' && github.event.inputs.regenerate_all == 'true'
54- uses : peter-evans/create-pull-request@v6
55- with :
56- token : ${{ secrets.GITHUB_TOKEN }}
57- title : " docs: AI-generated documentation updates"
58- body : |
59- This PR contains AI-generated documentation updates based on the codebase.
60-
61- **Please review carefully before merging.**
62-
63- - [ ] Documentation is accurate
64- - [ ] No internal/sensitive information exposed
65- - [ ] Material for MkDocs features utilized
66- - [ ] Navigation structure is logical
67- - [ ] No banned terms (Qdrant, Redis, LangChain, cards)
68- commit-message : " docs: update documentation with AI assistance"
69- branch : docs/ai-updates-${{ github.run_id }}
70- base : main
71-
72- deploy-docs :
73- needs : generate-docs
74- if : github.ref == 'refs/heads/main'
75- runs-on : ubuntu-latest
76- environment :
77- name : github-pages
78- url : ${{ steps.deployment.outputs.page_url }}
79- steps :
80- - uses : actions/checkout@v4
81- with :
82- fetch-depth : 0
83-
84- - uses : actions/setup-python@v5
85- with :
86- python-version : ' 3.11'
87-
88- - name : Install dependencies
66+ - name : Commit and push docs updates
8967 run : |
90- python -m pip install --upgrade pip
91- pip install mkdocs==1.6.1 mkdocs-material==9.7.1 pymdown-extensions==10.7.1
92- pip install mike==2.1.0 mkdocs-git-revision-date-localized-plugin==1.2.6 mkdocs-minify-plugin==0.8.0
93- pip install mkdocs-glightbox
94-
95- - name : Build documentation
96- run : mkdocs build --strict
97-
98- - name : Setup Pages
99- uses : actions/configure-pages@v4
100-
101- - name : Upload artifact
102- uses : actions/upload-pages-artifact@v3
103- with :
104- path : ' site'
105-
106- - name : Deploy to GitHub Pages
107- id : deployment
108- uses : actions/deploy-pages@v4
68+ if git diff --cached --quiet; then
69+ echo "No docs changes to commit."
70+ exit 0
71+ fi
72+ git config user.name "github-actions[bot]"
73+ git config user.email "github-actions[bot]@users.noreply.github.com"
74+ git commit -m "docs(ai): autopilot update"
75+ git push origin HEAD:${{ github.ref_name }}
0 commit comments