-
Notifications
You must be signed in to change notification settings - Fork 19
96 lines (84 loc) · 2.64 KB
/
Copy pathcheck-docs-updated.yml
File metadata and controls
96 lines (84 loc) · 2.64 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Check / Docs Updated
on:
workflow_call:
push:
branches: [main]
paths:
- .github/workflows/check-docs-updated.yml
- .github/actions/setup-nix/action.yml
- .cargo/config.toml
- Cargo.toml
- Cargo.lock
- Makefile.toml
- rust-toolchain.toml
- flake.nix
- flake.lock
- contracts/**/*.rs
- contracts/**/Cargo.toml
- contracts/**/Makefile.toml
- contracts/**/metadata.json
- packages/**/*.rs
- packages/**/Cargo.toml
pull_request:
branches: [main]
paths:
- .github/workflows/check-docs-updated.yml
- .github/actions/setup-nix/action.yml
- .cargo/config.toml
- Cargo.toml
- Cargo.lock
- Makefile.toml
- rust-toolchain.toml
- flake.nix
- flake.lock
- contracts/**/*.rs
- contracts/**/Cargo.toml
- contracts/**/Makefile.toml
- contracts/**/metadata.json
- packages/**/*.rs
- packages/**/Cargo.toml
permissions:
contents: read
concurrency:
group: check-docs-updated-${{ github.ref }}
cancel-in-progress: true
jobs:
check-docs-updated:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Cache cargo registry
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
~/.rustup
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Setup Nix
uses: ./.github/actions/setup-nix
- name: Generate schema
run: nix develop -c cargo make schema
- name: Generate documentations
run: nix develop -c cargo make docs
- name: Verify changed docs files
id: verify-changed-docs-files
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20
with:
files: |
docs/*.md
- name: Run step only when files change.
if: steps.verify-changed-docs-files.outputs.files_changed == 'true'
run: |
echo "❌ Documentation files have been updated."
echo " Changed files : ${{ steps.verify-changed-docs-files.outputs.changed_files }}"
git diff --name-only | grep 'docs/' | while read -r file; do
echo "‣ Changes in $file:"
git diff HEAD "$file"
done
echo "Please generate docs using \`cargo make docs\` then commit this new documentation."
exit 1