-
Notifications
You must be signed in to change notification settings - Fork 75
47 lines (41 loc) · 1.6 KB
/
full-help-docs.yml
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
name: CLI Help Doc
on:
push:
branches: [main, release/**]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}
cancel-in-progress: true
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
jobs:
complete:
if: always()
needs: [doc-check]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
doc-check:
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v4
- uses: stellar/actions/rust-cache@main
- run: rustup update
- name: Generate help doc
# this looks goofy to get GITHUB_OUTPUT to work with multi-line return values;
# see https://stackoverflow.com/a/74266196/249801
run: |
make generate-full-help-doc
raw_diff=$(git diff FULL_HELP_DOCS.md)
if [ "$raw_diff" != "" ]; then echo ""; echo "Unexpected docs change:"; echo "======================="; echo ""; echo "$raw_diff"; echo ""; echo "======================="; echo ""; fi
echo diff=$raw_diff >> $GITHUB_OUTPUT
id: doc-gen
- name: Check diff
if: steps.doc-gen.outputs.diff != ''
uses: actions/github-script@v7
with:
script: |
core.setFailed('Expected `doc-gen` to generate no diffs, but got diff shown in previous step.\n\nUpdate the full help docs:\n\n cargo md-gen\n\nDo this automatically on every commit by installing the pre-commit hook as explained in the README.')