Skip to content

Commit

Permalink
Add broken link checking Action
Browse files Browse the repository at this point in the history
Also adjusts the entire workflow to only run if a PR or push contains changes to a markdown file
  • Loading branch information
wolf99 committed May 14, 2022
1 parent 46d1b3c commit 29a8218
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion .github/workflows/lint-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,49 @@ on:
workflow_dispatch:
push:
branches: [ main, linux ]
paths:
- '**.md'
pull_request:
branches: [ main, linux ]
paths:
- '**.md'

jobs:
lint-markdown:
name: Lint markdown files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b

- uses: DavidAnson/markdownlint-cli2-action@744f913a124058ee903768d3adb92a4847e5d132
with:
globs: "**/*.md"

check-links:
name: Check for broken links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b

- name: Run link checker
# For any troubleshooting, see:
# https://github.com/lycheeverse/lychee/blob/master/docs/TROUBLESHOOTING.md
uses: lycheeverse/lychee-action@f1da3291e1d03cbe11a413ae9f16b62fec99e6b6

with:
# user-agent: if a user agent is not specified, some websites (e.g.
# GitHub Docs) return HTTP errors which Lychee will interpret as
# a broken link.
# no-progress: do not show progress bar. Recommended for
# non-interactive shells (e.g. for CI)
# inputs: by default (.), this action checks files matching the
# patterns: './**/*.md' './**/*.html'
args: >-
--user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"
--no-progress .
fail: true
env:
# A token is used to avoid GitHub rate limiting. A personal token with
# no extra permissions is enough to be able to check public repos
# See: https://github.com/lycheeverse/lychee#github-token
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 29a8218

Please sign in to comment.