-
Notifications
You must be signed in to change notification settings - Fork 122
103 lines (89 loc) · 3.09 KB
/
markdown-checks.yaml
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
97
98
99
100
101
102
103
name: Markdown checks
on:
push:
branches:
- 'main'
- '[0-9]+.[1-9][0-9]*.x'
paths:
- '**.md'
- 'lifecycle-operator/apis/**'
- 'metrics-operator/api/**'
pull_request:
branches:
- 'main'
- '[0-9]+.[1-9][0-9]*.x'
paths:
- '**.md'
- 'lifecycle-operator/apis/**'
- 'metrics-operator/api/**'
# Declare default permissions as read only.
permissions: read-all
env:
GO_VERSION: "~1.23"
defaults:
run:
shell: bash
jobs:
markdown-link-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # v1
with:
config-file: '.github/mlc_config.json'
use-verbose-mode: true
use-quiet-mode: true
folder-path: 'examples,docs'
file-path: 'README.md'
markdown-lint:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Run TOC generation
run: |
FILES=`find . -type f -name '*.md' -not -path './.github/*' -not -path './node_modules/*' | sort`
for f in $FILES; do
if grep -q '<!-- tocstop -->' $$f; then
echo "Checking TOC for ${f}";
npx markdown-toc --no-first-h1 --no-stripHeadingTags -i ${f} || exit 1;
else
echo Skipping ${f};
fi;
done
- name: Check TOC
run: |
git diff --exit-code '*.md' || \
(echo "Table of Contents is out of date. Please update the following files: $(git diff --name-status --exit-code)" && exit 1)
- name: Lint Markdown files
run: make markdownlint
check-crd-docs:
name: Check CRD auto-generated docs
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Go 1.x
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: false
- name: Copy old docs
run: |
cp -R ./docs/docs/reference/api-reference ./docs/docs/reference/api-reference-old
- name: Run docs generator
run: ./.github/scripts/generate-crd-docs/generate-crd-docs.sh
- name: Check if docs are up to date
run: |
if ! diff -rq ./docs/docs/reference/api-reference ./docs/docs/reference/api-reference-old &>/dev/null; then
echo "The CRD docs have changes that are not reflected in the docs pages."
echo "Please use ./.github/scripts/generate-crd-docs/generate-crd-docs.sh to re-generate the docs."
echo ""
echo "=========== Diff ==========="
diff -ru ./docs/docs/reference/api-reference ./docs/docs/reference/api-reference-old
exit 1
else
echo ""
echo "CRD docs are up to date!"
fi