-
Notifications
You must be signed in to change notification settings - Fork 1.9k
130 lines (110 loc) · 4.52 KB
/
documentation.yml
File metadata and controls
130 lines (110 loc) · 4.52 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build and deploy camel documents
on:
push:
branches: [ "master", "qa" ]
workflow_dispatch:
permissions:
contents: read
jobs:
docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python environment and install dependencies
uses: ./.github/actions/camel_install
with:
python-version: "3.10"
# Determine the commit to diff against so we only process changed docs
- name: Determine BASE_SHA for diff
id: diff
run: |
if git rev-parse --verify -q HEAD^1 >/dev/null; then
echo "BASE_SHA=$(git rev-parse HEAD^1)" >> $GITHUB_OUTPUT
else
echo "BASE_SHA=${{ github.event.before }}" >> $GITHUB_OUTPUT
fi
- name: Install Pandoc
run: sudo apt-get install -y pandoc
- name: Convert Cookbooks and Update Mintlify Config
run: |
source .venv/bin/activate
BASE_SHA="${{ steps.diff.outputs.BASE_SHA }}"
echo "Incremental mode - processing changed cookbooks files since $BASE_SHA"
python docs/mintlify/convert_notebook2mdx.py \
--input docs/cookbooks \
--output docs/mintlify \
--update-docs-json docs/mintlify/docs.json \
--docs-path-prefix "" \
--incremental --use-git --base-branch "$BASE_SHA" \
--verbose
- name: Convert Get Started docs
run: |
source .venv/bin/activate
BASE_SHA="${{ steps.diff.outputs.BASE_SHA }}"
echo "Incremental mode - processing changed get_started files since $BASE_SHA"
python docs/mintlify/convert_notebook2mdx.py \
--input docs/get_started \
--output docs/mintlify \
--update-docs-json docs/mintlify/docs.json \
--docs-path-prefix "" \
--incremental --use-git --base-branch "$BASE_SHA" \
--verbose
- name: Convert Key Modules docs
run: |
source .venv/bin/activate
BASE_SHA="${{ steps.diff.outputs.BASE_SHA }}"
echo "Incremental mode - processing changed key_modules files since $BASE_SHA"
python docs/mintlify/convert_notebook2mdx.py \
--input docs/key_modules \
--output docs/mintlify \
--update-docs-json docs/mintlify/docs.json \
--docs-path-prefix "" \
--incremental --use-git --base-branch "$BASE_SHA" \
--verbose
- name: Sync modified MDX files back to source docs
run: |
source .venv/bin/activate
BASE_SHA="${{ steps.diff.outputs.BASE_SHA }}"
echo "Reverse sync - processing changed MDX files since $BASE_SHA"
python docs/mintlify/convert_notebook2mdx.py \
--input docs/mintlify \
--output docs/mintlify \
--update-docs-json docs/mintlify/docs.json \
--docs-path-prefix "" \
--incremental --use-git --base-branch "$BASE_SHA" \
--verbose
- name: Generate API Documentation
run: |
source .venv/bin/activate
echo "Using incremental API docs generation for optimal performance"
python docs/mintlify/build_api_docs.py \
--output_dir docs/mintlify/reference \
--mint_json docs/mintlify/docs.json \
--package camel \
--incremental \
--since_hours 24
- name: Commit and push changes
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git config --global user.name "camel-docs-bot"
git config --global user.email "[email protected]"
git add docs/mintlify/ docs/mintlify/get_started/ docs/mintlify/key_modules/ docs/mintlify/reference/ docs/mintlify/docs.json
git add docs/
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Auto-update documentation after merge [skip ci]"
git remote set-url origin https://x-access-token:${PAT_TOKEN}@github.com/${{ github.repository }}
git push origin ${{ github.ref_name }}
fi