-
Notifications
You must be signed in to change notification settings - Fork 334
77 lines (65 loc) · 2.34 KB
/
generate.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
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
name: "Generate docs/examples"
on:
push:
pull_request:
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V28
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v15
with:
name: devenv
- run: nix profile install . -L --accept-flake-config
- name: Generate doc options
run: devenv shell devenv-generate-doc-options
- uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
add: docs/reference/options.md
message: 'Auto generate docs/reference/options.md'
- name: Verify individual docs
run: devenv shell devenv-verify-individual-docs
- uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
message: 'Auto generate missing individual markdowns'
- name: Generate docs and supported-languages example
run: |
devenv shell devenv-generate-docs
devenv shell devenv-generate-languages-example
devenv shell devenv-generate-individual-docs
- uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
add: docs examples/supported-languages/devenv.nix
message: 'Auto generate docs and examples'
- name: Generate JSON schema
run: devenv generate-json-schema
- uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
add: docs/devenv.schema.json
message: 'Auto generate docs/devenv.schema.json'
- name: Check for uncommitted changes
run: |
diff=$(git diff --stat)
if [[ -n "$diff" ]]; then
message="There are uncommitted doc changes in the repository.
${diff}
To resolve this, you can:
a. Run the failing devenv-generate-* commands locally and commit the changes.
b. Let CI auto-commit the changes to your fork of the repo. You may need to enable this workflow on your fork."
echo "::error::${message//$'\n'/%0A}"
exit 1
else
echo "No uncommitted doc changes found."
fi