Check links #2675
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
# 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" |