-
-
Notifications
You must be signed in to change notification settings - Fork 18
63 lines (52 loc) · 1.98 KB
/
cron-check-links.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
# 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 Sunday
- cron: '15 3 * * 0'
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 asdf & tools in .tool-versions
uses: asdf-vm/actions/install@v2
- name: Install npm modules for Hugo
run: npm install
- name: Install Muffet
run: |
GO111MODULE=on go install github.com/raviqqe/[email protected]
asdf reshim golang
# 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