-
Notifications
You must be signed in to change notification settings - Fork 30
29 lines (29 loc) · 1.04 KB
/
link-checker-pr.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
name: Link Checker for Pull requests
on: pull_request
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: changed_files
uses: jitterbit/get-changed-files@v1
- name: Link Checker
uses: lycheeverse/[email protected]
id: lychee
env:
GITHUB_TOKEN: ${{secrets.TOKEN_GITHUB}}
with:
args: ${{ steps.changed_files.outputs.all }}
- name: Count broken links
run: |
broken_max=10
broken_count=$(printf "%d" $(grep "🚫 Errors" lychee/out.md | cut -d'|' -f3))
if [ "$broken_count" -gt "$broken_max" ]; then
echo "Number of broken links (${broken_count}) exceeds maximum allowed number (${broken_max})."
echo "Broken links: "
echo "$broken"
exit 1
else
echo "Number of broken links (${broken_count}) less than or equal to maximum allowed number (${broken_max})."
exit 0
fi