Skip to content

Commit d32e61b

Browse files
authored
CI - Check the CLI docs (#318)
* [bfops/cli-ci]: CI - Check the CLI docs * [bfops/cli-ci]: fix * [bfops/cli-ci]: fix permission warnings * [bfops/cli-ci]: review * [bfops/cli-ci]: review --------- Co-authored-by: Zeke Foppa <[email protected]>
1 parent 50b7298 commit d32e61b

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
pull_request:
3+
workflow_dispatch:
4+
inputs:
5+
ref:
6+
description: 'SpacetimeDB ref'
7+
required: false
8+
default: ''
9+
permissions: read-all
10+
11+
name: Check CLI docs
12+
13+
jobs:
14+
cli_docs:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Find Git ref
18+
shell: bash
19+
run: |
20+
echo "GIT_REF=${{ github.event.inputs.ref || 'master' }}" >>"$GITHUB_ENV"
21+
- name: Checkout sources
22+
uses: actions/checkout@v4
23+
with:
24+
repository: clockworklabs/SpacetimeDB
25+
ref: ${{ env.GIT_REF }}
26+
- uses: dsherret/rust-toolchain-file@v1
27+
- name: Checkout docs
28+
uses: actions/checkout@v4
29+
with:
30+
path: spacetime-docs
31+
- name: Check for docs change
32+
run: |
33+
cargo run --features markdown-docs -p spacetimedb-cli > ../spacetime-docs/docs/cli-reference.md
34+
cd spacetime-docs
35+
# This is needed because our website doesn't render markdown quite properly.
36+
# See the README in spacetime-docs for more details.
37+
sed -i'' -E 's!^(##) `(.*)`$!\1 \2!' docs/cli-reference.md
38+
sed -i'' -E 's!^(######) \*\*(.*)\*\*$!\1 <b>\2</b>!' docs/cli-reference.md
39+
git status
40+
if git diff --exit-code HEAD; then
41+
echo "No docs changes detected"
42+
else
43+
echo "It looks like the CLI docs have changed."
44+
echo "These docs are expected to match exactly the helptext generated by the CLI in SpacetimeDB (${{env.GIT_REF}})."
45+
echo "Once a corresponding change has merged in SpacetimeDB, re-run this check."
46+
echo "See https://github.com/clockworklabs/spacetime-docs/#cli-reference-section for more info on how to generate these docs from SpacetimeDB."
47+
exit 1
48+
fi

0 commit comments

Comments
 (0)