-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
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@v3 | ||
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) | ||
exit 0 | ||
- 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) | ||
exit 0 | ||
- 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" |