-
Notifications
You must be signed in to change notification settings - Fork 32
121 lines (101 loc) · 3.43 KB
/
doc.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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# This is a basic workflow to help you get started with Actions
name: Documentation
on: [push, pull_request]
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
name: Skip Duplicate Actions
uses: fkirc/skip-duplicate-actions@v4.0.0
with:
concurrent_skipping: 'same_content'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
paths: '["**.md", "**/readme.yaml", "scripts/**", "Makefile", ".github/workflows/doc.yml"]'
changed_files:
runs-on: ubuntu-latest
outputs:
modules_readme: ${{ steps.changes.outputs.modules_readme }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: changes
# Set outputs using the command.
run: |
echo ${GITHUB_REF}
if [ "${GITHUB_REF}" == "refs/heads/master" ]; then
echo "::set-output name=modules_readme::*,"
echo "master detected, consider all files as changed"
else
changed_files=$(git diff --name-only --diff-filter=ACMRT $(git merge-base --fork-point origin/master))
changed_files_readme=$(echo "${changed_files}" | grep 'readme\.yaml$') || changed_files_readme=""
echo ::set-output name=modules_readme::$(dirname $(echo "${changed_files_readme}") | uniq | tr '\n' ',') || true
echo -e "readme changed files:\n${changed_files_readme}"
fi
continue-on-error: true
modules:
needs: [pre_job, changed_files]
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
container:
image: "claranet/terraform-ci:latest"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate modules doc
run: |
echo "${{needs.changed_files.outputs.modules_readme}}"
echo -n "${{needs.changed_files.outputs.modules_readme}}" | while read -d ',' dir; do
echo "process $(dirname ${dir}).."
make update-module-readme "$(basename $(dirname ${dir}))"
done
make update-toc
- name: Check for changes
run: git diff --exit-code
severity:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
container:
image: "claranet/terraform-ci:latest"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate severity doc
run: make update-severity-doc
- name: Check for changes
run: git diff --exit-code
spell_check:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run PySpelling
uses: rojopolis/spellcheck-github-actions@0.35.0
dead_links:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check dead links in Markdown
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: yes
use-verbose-mode: yes
check-modified-files-only: yes
config-file: .mlc_config.json