-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (55 loc) · 1.81 KB
/
Copy pathapi-docs.yml
File metadata and controls
65 lines (55 loc) · 1.81 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
name: API Docs
on:
workflow_dispatch:
schedule:
- cron: "23 4 * * 1"
push:
branches: [main]
paths:
- ".github/workflows/api-docs.yml"
- "Cargo.toml"
- "Cargo.lock"
- "crates/server/src/routes/**"
- "crates/server/tests/openapi_drift.rs"
- "crates/xtask/Cargo.toml"
- "crates/xtask/src/api_docs.rs"
- "crates/xtask/src/main.rs"
- "crates/xtask/src/openapi_check.rs"
permissions:
contents: write
concurrency:
group: api-docs-${{ github.ref }}
cancel-in-progress: false
jobs:
update:
name: Update API Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
- uses: cachix/install-nix-action@v31
- name: Generate API docs
run: nix develop --command cargo run -p circus-xtask -- api-docs
- name: Check OpenAPI route coverage
run: nix develop --command cargo run -p circus-xtask -- openapi-check
- name: Refuse unexpected generated changes
run: git diff --exit-code -- . ":!docs/API.md"
- name: Detect API docs changes
id: api-docs-changes
run: |
if git diff --quiet -- docs/API.md; then
echo "changed=false" >> "${GITHUB_OUTPUT}"
exit 0
fi
echo "changed=true" >> "${GITHUB_OUTPUT}"
- name: Commit updated API docs
if: steps.api-docs-changes.outputs.changed == 'true'
run: |
git add docs/API.md
git -c user.name="github-actions[bot]" \
-c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -m "docs: update generated API reference"
git pull --rebase --autostash origin "${GITHUB_REF_NAME}"
git push origin "HEAD:${GITHUB_REF_NAME}"