-
Notifications
You must be signed in to change notification settings - Fork 7
52 lines (43 loc) · 1.75 KB
/
link-check.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
# SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: AGPL-3.0-only
name: Check links
on:
push:
schedule:
- cron: "0 3 * * *"
jobs:
check-links:
runs-on: ubuntu-latest
name: Check for broken links
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline && yarn add broken-link-checker
- name: Run Hugo
run: hugo server -e production --minify -b http://127.0.0.1:1313/ & sleep 5
- name: Check for broken links
# GitHub is excluded because we otherwise run into rate-limits and get many HTTP_429 link errors.
# Domains under hedgedoc.org are excluded since they always fail due to our bot-protection mode on Cloudflare.
run: node_modules/.bin/blc http://127.0.0.1:1313/ -ro --exclude "https://github.com/*" --exclude "https://docs.github.com/*" --exclude "https://docs.hedgedoc.org" --exclude "https://demo.hedgedoc.org" --exclude "https://hedgedoc.org" --exclude "https://hackmd.io"