-
Notifications
You must be signed in to change notification settings - Fork 1.2k
86 lines (76 loc) · 2.66 KB
/
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Links
on:
merge_group:
pull_request:
jobs:
build-and-check-links:
name: BUILD and CHECK LINKS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create NPM cache-hash input file
run: |
mkdir -p tmp
jq '{devDependencies, dependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
- name: Create and use reduced-dependencies package.json
run: |
jq '.devDependencies |= with_entries(
select(.key | test("prefix|hugo|css"))
)
| del(.dependencies, .optionalDependencies)' \
package.json > tmp/package-min.json
cp tmp/package-min.json package.json
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json
- run: |
npm install --omit=optional
git restore package.json
- name: Git submodules properly pinned?
run: |
npm run seq pin:submodule
echo "If the diff check below fails, then update .gitmodules by pinning the named git"
echo "submodule(s); or undo the submodule update(s) if it happened by mistake."
npm run _diff:fail
- run: npm run log:check:links
continue-on-error: true
- name: Any files need updating?
run: |
echo "If the diff fails due to .htmltest, then either run 'npm run fix:htmltest-config' locally or '/fix:htmltest-config' in GitHub"
npm run _diff:fail
- uses: actions/upload-artifact@v4
if: failure()
with:
name: build-log-etc
path: |
tmp/build-log.txt
tmp/package*.json
static/refcache.json
check-refcache:
name: REFCACHE updates?
needs: build-and-check-links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: { name: build-log-etc }
- name: Fail when refcache contains entries with HTTP status 4XX
run: |
if grep -B 1 -e '"StatusCode": 4' static/refcache.json; then
echo "Run 'npx gulp prune' to remove 4xx entries from the refcache"
exit 1
fi
- name: Does the refcache need updating?
run: npm run diff:fail
check-build-log-for-issues:
name: WARNINGS in build log?
needs: build-and-check-links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: { name: build-log-etc }
- run: cat tmp/build-log.txt
- run: scripts/check-build-log.sh