-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (133 loc) · 4.74 KB
/
wiki_checks.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Wiki Quality Checks
on:
workflow_dispatch:
schedule:
- cron: "0 18 * * 1,3,5"
jobs:
test:
name: Run Quality Checks
runs-on: ubuntu-22.04
steps:
- name: Clone GitHub Wiki
id: checkout
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}.wiki
- name: Install pandoc and xmllint
id: setup-parsers
run: |
sudo apt-get update
sudo apt-get install pandoc libxml2-utils
- name: Verify link integrity
id: check-link-integrity
if: (success() || failure()) && steps.setup-parsers.outcome == 'success'
run: |
set -o pipefail
./.scripts/check-markdown-links | ./.scripts/log-github | \
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
- name: Check marked external links
id: check-external-link-indicators
if: (success() || failure()) && steps.checkout.outcome == 'success'
run: |
# set -o pipefail
./.scripts/check-link-indicators | ./.scripts/log-github --level notice | \
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
- name: Install linters
id: setup-linters
if: (success() || failure()) && steps.checkout.outcome == 'success'
run: |
sudo apt-get install yamllint
- name: Lint markdown code blocks
id: lint-code-blocks
if: (success() || failure()) && steps.setup-linters.outcome == 'success'
run: |
set -o pipefail
./.scripts/lint-code-blocks | ./.scripts/log-github | \
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
- name: Install git-filter-repo
id: setup-git-filter-repo
if: (success() || failure()) && steps.checkout.outcome == 'success'
run: |
sudo apt-get install git-filter-repo
- name: Check for renamed files
id: check-renamed-files
if: (success() || failure()) && steps.setup-git-filter-repo.outcome == 'success'
run: |
# set -o pipefail
./.scripts/check-renamed-files | ./.scripts/log-github --level warning | \
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
- name: Check for duplicate files
id: check-duplicate-files
if: (success() || failure()) && steps.checkout.outcome == 'success'
run: |
set -o pipefail
./.scripts/check-duplicate-files | ./.scripts/log-github | \
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
- name: Report issues
if: failure()
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
STEPS_CONTEXT: ${{ toJSON(steps) }}
run: |
WORKFLOW_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "$STEPS_CONTEXT" | jq --raw-output \
--arg workflow_url "$WORKFLOW_URL" \
--arg job_url "$WORKFLOW_URL/jobs/$GITHUB_JOB" \
--arg timestamp "$(date --iso-8601=minutes)" \
'
{ embeds: [
([
to_entries[] |
select(
(
.key == "checkout" or
(.key | startswith("setup-"))
) and .value.outcome != "success"
) |
{
name: .key,
value: .value.outcome,
inline: false,
}
] | if . | any then . | {
title: "Everest Wiki Workflow Run",
description: "**:rotating_light:!!SETUP FAILED!!:rotating_light:**",
url: $job_url,
color: 16711680,
fields: .,
timestamp: $timestamp,
footer: {
text: "This Action is run Mon/Wed/Fri at 18:00UTC"
}
} else empty end),
([
to_entries[] |
select(
(
.key == "checkout" or
(.key | startswith("setup-"))
) | not
) |
{
name: .key,
value: (
.value.outcome +
if .value.outcome == "failure" then
" (" + .value.outputs["msg-count"] + " issues)"
else "" end
),
inline: false,
}
] | {
title: "Everest Wiki Workflow Run",
description: "**Checks Failed:**",
url: $workflow_url,
color: 16711680,
fields: .,
timestamp: $timestamp,
footer: {
text: "This Action is run Mon/Wed/Fri at 18:00UTC"
}
})
], allowed_mentions: ({parse: []})}
' | curl -X POST -H "Content-Type: application/json" --data @- "$WEBHOOK_URL"