Skip to content

Commit 76e9fd8

Browse files
authored
Create wiki_checks.yml
1 parent d75baa7 commit 76e9fd8

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed

.github/workflows/wiki_checks.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: Wiki Quality Checks
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 18 * * 1,3,5"
7+
8+
jobs:
9+
test:
10+
name: Run Quality Checks
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Clone GitHub Wiki
14+
id: checkout
15+
uses: actions/checkout@v3
16+
with:
17+
repository: ${{ github.repository }}.wiki
18+
19+
20+
- name: Install pandoc and xmllint
21+
id: setup-parsers
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install pandoc libxml2-utils
25+
26+
- name: Verify link integrity
27+
id: check-link-integrity
28+
if: (success() || failure()) && steps.setup-parsers.outcome == 'success'
29+
run: |
30+
set -o pipefail
31+
./.scripts/check-markdown-links | ./.scripts/log-github | \
32+
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
33+
34+
35+
- name: Check marked external links
36+
id: check-external-link-indicators
37+
if: (success() || failure()) && steps.checkout.outcome == 'success'
38+
run: |
39+
# set -o pipefail
40+
./.scripts/check-link-indicators | ./.scripts/log-github --level notice | \
41+
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
42+
exit 0
43+
44+
45+
- name: Install linters
46+
id: setup-linters
47+
if: (success() || failure()) && steps.checkout.outcome == 'success'
48+
run: |
49+
sudo apt-get install yamllint
50+
51+
- name: Lint markdown code blocks
52+
id: lint-code-blocks
53+
if: (success() || failure()) && steps.setup-linters.outcome == 'success'
54+
run: |
55+
set -o pipefail
56+
./.scripts/lint-code-blocks | ./.scripts/log-github | \
57+
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
58+
59+
60+
- name: Install git-filter-repo
61+
id: setup-git-filter-repo
62+
if: (success() || failure()) && steps.checkout.outcome == 'success'
63+
run: |
64+
sudo apt-get install git-filter-repo
65+
66+
- name: Check for renamed files
67+
id: check-renamed-files
68+
if: (success() || failure()) && steps.setup-git-filter-repo.outcome == 'success'
69+
run: |
70+
# set -o pipefail
71+
./.scripts/check-renamed-files | ./.scripts/log-github --level warning | \
72+
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
73+
exit 0
74+
75+
76+
- name: Check for duplicate files
77+
id: check-duplicate-files
78+
if: (success() || failure()) && steps.checkout.outcome == 'success'
79+
run: |
80+
set -o pipefail
81+
./.scripts/check-duplicate-files | ./.scripts/log-github | \
82+
tee >(wc -l | sed 's/^/msg-count=/' >> $GITHUB_OUTPUT)
83+
84+
85+
- name: Report issues
86+
if: failure()
87+
env:
88+
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
89+
STEPS_CONTEXT: ${{ toJSON(steps) }}
90+
run: |
91+
WORKFLOW_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
92+
echo "$STEPS_CONTEXT" | jq --raw-output \
93+
--arg workflow_url "$WORKFLOW_URL" \
94+
--arg job_url "$WORKFLOW_URL/jobs/$GITHUB_JOB" \
95+
--arg timestamp "$(date --iso-8601=minutes)" \
96+
'
97+
{ embeds: [
98+
([
99+
to_entries[] |
100+
select(
101+
(
102+
.key == "checkout" or
103+
(.key | startswith("setup-"))
104+
) and .value.outcome != "success"
105+
) |
106+
{
107+
name: .key,
108+
value: .value.outcome,
109+
inline: false,
110+
}
111+
] | if . | any then . | {
112+
title: "Everest Wiki Workflow Run",
113+
description: "**:rotating_light:!!SETUP FAILED!!:rotating_light:**",
114+
url: $job_url,
115+
color: 16711680,
116+
fields: .,
117+
timestamp: $timestamp,
118+
footer: {
119+
text: "This Action is run Mon/Wed/Fri at 18:00UTC"
120+
}
121+
} else empty end),
122+
([
123+
to_entries[] |
124+
select(
125+
(
126+
.key == "checkout" or
127+
(.key | startswith("setup-"))
128+
) | not
129+
) |
130+
{
131+
name: .key,
132+
value: (
133+
.value.outcome +
134+
if .value.outcome == "failure" then
135+
" (" + .value.outputs["msg-count"] + " issues)"
136+
else "" end
137+
),
138+
inline: false,
139+
}
140+
] | {
141+
title: "Everest Wiki Workflow Run",
142+
description: "**Checks Failed:**",
143+
url: $workflow_url,
144+
color: 16711680,
145+
fields: .,
146+
timestamp: $timestamp,
147+
footer: {
148+
text: "This Action is run Mon/Wed/Fri at 18:00UTC"
149+
}
150+
})
151+
], allowed_mentions: ({parse: []})}
152+
' | curl -X POST -H "Content-Type: application/json" --data @- "$WEBHOOK_URL"

0 commit comments

Comments
 (0)