-
Notifications
You must be signed in to change notification settings - Fork 19
64 lines (64 loc) · 2.45 KB
/
workflow-validate-website-content.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
name: Validate Website Content
on:
workflow_call:
inputs:
site_git_ref:
description: 'git ref, a SHA commit or branch or tag, for the published HTML content'
required: true
default: 'nist-pages'
type: string
site_git_ref_path:
description: 'the subdirectory to check out git ref and check links in website content'
required: true
default: 'published'
type: string
linkcheck_create_issue:
description: 'create new GitHub issue if broken links found'
required: false
default: false
type: boolean
linkcheck_fail_on_error:
description: 'create new GitHub issue if broken links found'
required: false
default: false
type: boolean
jobs:
schedule-validate-website-links:
runs-on: ubuntu-20.04
permissions:
contents: read
issues: write
steps:
- name: Checkout Latest
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
fetch-depth: 0 # this ensures that the tag and commit history are available
- name: Checkout git ref of published website content
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
ref: ${{ inputs.site_git_ref }}
path: ${{ inputs.site_git_ref_path }}
- name: Check website HTML content links
id: linkchecker
uses: lycheeverse/lychee-action@c053181aa0c3d17606addfe97a9075a32723548a
with:
args: --exclude-file .github/workflows/config/.lycheeignore --verbose --no-progress --accept 200,206,429 './${{ inputs.site_git_ref_path }}/**/*.html' --exclude-mail
fail: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Create issue if bad links detected
if: ${{ !cancelled() && env.lychee_exit_code != 0 && inputs.linkcheck_create_issue }}
uses: peter-evans/create-issue-from-file@24452a72d85239eacf1468b0f1982a9f3fec4c94
with:
title: Scheduled Check of Website Content Found Bad Hyperlinks
content-filepath: ./lychee/out.md
labels: |
bug
documentation
- name: Check coverage tolerance
if: ${{ env.lychee_exit_code != 0 && inputs.linkcheck_fail_on_error }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
core.setFailed('Link checker detected broken or invalid links, read attached report.')