-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (88 loc) · 2.89 KB
/
ci.yaml
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
---
name: CI
on: [push]
jobs:
pre-commit-checks:
runs-on: ubuntu-latest
steps:
- name: Check out repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v3
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Run pre-commit checks
uses: pre-commit/[email protected]
html-proofer-internal-links:
name: "HTML proofer internal links"
runs-on: ubuntu-latest
needs: pre-commit-checks
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: head
- name: Install html-proofer
run: gem install html-proofer -v '~>5'
- name: Build
run: hugo --minify
- name: Run html-proofer
# swap URLs
# - adjust for base URL (REG-handbook)
# Ignore internal links to base URL
# Only check internal links
# Ignore contributors table, which has many links we don't control
run: |
htmlproofer ./public \
--disable-external \
--swap-urls "^/REG-handbook/:/" \
--ignore-urls '/REG-handbook' \
--ignore-files './public/docs/contributors/index.html'
html-proofer-external-links:
name: "HTML proofer external links"
runs-on: ubuntu-latest
needs: pre-commit-checks
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: head
- name: Install html-proofer
run: gem install html-proofer -v '~>5'
- name: Build
run: hugo --minify
- name: Run html-proofer
# swap URLs
# - adjust for internal links with fqdn (https://alan-turing-institute.github.io/REG-handbook)
# - adjust for base URL (REG-handbook)
# - Adjust edit and tree paths on GitHub to current branch (*/edit/main, */tree/main)
# Only check external and internal links
# Ignore contributors table, which has many links we don't control
run: |
htmlproofer ./public \
--swap-urls "^https\://alan-turing-institute.github.io/REG-handbook/:/,^/REG-handbook/:/,/edit/main:/edit/$(git branch --show-current)" \
--ignore-urls '/REG-handbook,/turing.ac.uk/,/github.com/,/docs.github.com/' \
--ignore-files './public/docs/contributors/index.html'