Skip to content

Commit 3287a5a

Browse files
authored
Merge pull request #17 from autowarefoundation/ci/add-build-docs-check
ci: add docs build check and PR preview for PRs with check-page label
2 parents fcfd92f + 96afba1 commit 3287a5a

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/build-docs.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: build-docs
2+
3+
on:
4+
pull_request:
5+
types: [labeled, synchronize, closed]
6+
7+
concurrency:
8+
group: preview-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
build:
17+
if: >-
18+
github.event.action != 'closed' &&
19+
contains(github.event.pull_request.labels.*.name, 'check-page')
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.10"
27+
28+
- name: Install dependencies
29+
run: |
30+
pip install -r requirements.txt
31+
sudo apt-get update && sudo apt-get install -y doxygen
32+
33+
- name: Generate API Reference
34+
env:
35+
BASE_REF: ${{ github.event.pull_request.base.ref }}
36+
run: ./generate_api.sh "$BASE_REF"
37+
38+
- name: Build docs
39+
run: mkdocs build -f mkdocs.yaml --strict
40+
41+
- uses: rossjrw/pr-preview-action@v1
42+
with:
43+
source-dir: ./site/
44+
45+
cleanup:
46+
if: github.event.action == 'closed'
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- uses: rossjrw/pr-preview-action@v1
52+
with:
53+
action: remove

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ pre-commit install
1616
```
1717

1818
From then on, `git commit` will run `markdownlint --fix` automatically against the staged Markdown files.
19+
20+
### Docs build check & PR preview
21+
22+
Apply the `check-page` label to a PR to trigger a full documentation build
23+
(`mkdocs build --strict`, including Doxygen API reference generation). If the
24+
build succeeds, a live preview is deployed to GitHub Pages and linked from the
25+
PR. The preview is removed automatically when the PR is closed.

0 commit comments

Comments
 (0)