-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
92 lines (88 loc) · 2.67 KB
/
action.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
87
88
89
90
91
92
name: gh-linkchecker
description: >-
Check links using LinkChecker, plus:
retry failures,
output as GitHub error/warning/notice annotations,
custom jq filters
branding:
icon: link
color: green
inputs:
urls:
required: false
description: >-
Space-separated list of URLs to crawl
(default: GitHub Pages URL of the invoking repository)
linkcheckerrc:
required: false
default: ''
description: >-
Configuration file for LinkChecker
custom-jq-filter:
required: false
default: '.'
description: >-
Custom jq filter/program that can be used to implement complex ignore
rules that can't be expressed in linkcheckerrc.
This filter is run after every linkchecker attempt, so using it to
upgrade warnings to errors will cause retries.
custom-jq-filter-post:
required: false
default: '.'
description: >-
Custom jq filter/program that can be used to implement complex ignore
rules that can't be expressed in linkcheckerrc, such as turning warnings
into errors or ignoring only temporary redirects but not permanent
redirects.
This filter is run after a successful (no errors) linkchecker attempt.
retries:
required: false
default: '1'
description: >-
Maximum number of retries
(default: 1)
runs:
using: composite
steps:
- name: Get pages URL
id: get-url
if: inputs.urls == ''
env:
GITHUB_TOKEN: ${{ github.token }}
shell: sh
run: |
url=$(gh api --jq .html_url repos/${{ github.repository }}/pages)
echo "url=$url" >> $GITHUB_OUTPUT
- name: Install latest jq
shell: sh
run: |
echo "::group::Install latest jq"
mkdir -p ~/.local/bin
wget -O ~/.local/bin/jq https://github.com/jqlang/jq/releases/latest/download/jq-linux-amd64
chmod +x ~/.local/bin/jq
echo ~/.local/bin >> $GITHUB_PATH
echo "::endgroup::"
- name: Install LinkChecker
uses: liskin/gh-pipx@v1
with:
packages: >-
'LinkChecker >= 10.4'
- name: Run LinkChecker
id: run
env:
LINKCHECKERRC: ${{ inputs.linkcheckerrc }}
CUSTOM_JQ_FILTER: ${{ inputs.custom-jq-filter }}
CUSTOM_JQ_FILTER_POST: ${{ inputs.custom-jq-filter-post }}
RETRIES: ${{ inputs.retries }}
shell: sh
run: |
$GITHUB_ACTION_PATH/run.sh ${{ inputs.urls || steps.get-url.outputs.url }}
- name: Upload artifacts
if: >-
!cancelled()
uses: actions/upload-artifact@v4
with:
name: linkchecker
path: |
${{ steps.run.outputs.dir }}/*.sql
${{ steps.run.outputs.dir }}/*.json