Test site for broken links #510
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
# Notes: | |
# - All software installed below is pinned so they don't get upgraded and break w/o us knowing why. | |
# - If you bump one version up to latest, please bump them all so we stay current! | |
# - Hugo builds the site twice: once for link checking and once minified for pushing live | |
# - Bash script for muffet is intentionally stand alone so devs/content editors can easily run it locally | |
# Scheduled workflows run on the latest commit on | |
# the default or base branch | |
on: | |
schedule: | |
# runs at 3:15am every day | |
- cron: '15 3 * * *' | |
name: Test site for broken links | |
jobs: | |
BuildLinkCheckPushLive: | |
name: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 15 | |
steps: | |
- name: Git checkout cht-docs repos | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Install hugo extended v0.101.0 | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.101.0" | |
extended: true | |
- name: Install Node 12.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: Install npm modules for Hugo | |
run: npm install | |
- name: Install Go v1.18 | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.18' | |
- name: Install Muffet v1.5.7 | |
run: GO111MODULE=on go install github.com/raviqqe/[email protected] | |
# run in background so CI doesn't hang waiting for "ctrl + c". Sleep ensures server is ready in next step | |
- name: Serve Hugo site | |
run: | | |
hugo server& | |
sleep 30 | |
- name: Set DNS to 9.9.9.9 | |
shell: bash | |
run: ./.github/scripts/set_dns.sh | |
- name: Run Muffet link checker | |
shell: bash | |
run: ./.github/scripts/muffet.sh | |
- name: Report errors to Slack, if any | |
if: ${{ github.ref == 'refs/heads/main' && failure() }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_WEBHOOK: '${{ secrets.SLACK_WEB_HOOK }}' | |
SLACK_CHANNEL: '#cht-doc-site' | |
SLACK_COLOR: '#3278BD' | |
SLACK_ICON: ":flappingphone:" | |
SLACK_MESSAGE: 'Broken Links Found' | |
SLACK_TITLE: CHT DOCS BAD LINKS | |
SLACK_USERNAME: Medic-Bot |