-
Notifications
You must be signed in to change notification settings - Fork 7
62 lines (54 loc) · 1.82 KB
/
linkcheck.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
name: Check URL Status
on:
workflow_dispatch:
schedule:
- cron: 0 0 * * 0 # run at midnight every Sunday
env:
LINK_TRACKING_ISSUE_NUMBER: 85
permissions:
issues: write
jobs:
check-urls:
if: ${{ !github.event.repository.fork }}
env:
LYCHEE_REPORT_FILE: ./lychee/out.md
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
- name: Read Lychee report
if: env.lychee_exit_code != 0
id: readReport
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "FILE_CONTENT<<$EOF" >> $GITHUB_OUTPUT
echo "$(cat ${{ env.LYCHEE_REPORT_FILE }})" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- run: echo "${{ steps.readReport.outputs.FILE_CONTENT }}"
- name: Update link tracking issue (update invalid links)
if: env.lychee_exit_code != 0
uses: actions-cool/issues-helper@v3
with:
actions: "update-issue"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ env.LINK_TRACKING_ISSUE_NUMBER }}
state: "open"
body: ${{ steps.readReport.outputs.FILE_CONTENT }}
update-mode: "replace"
- name: Update link tracking issue (no invalid links)
if: env.lychee_exit_code == 0
uses: actions-cool/issues-helper@v3
with:
actions: "update-issue"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ env.LINK_TRACKING_ISSUE_NUMBER }}
state: "closed"
body: "No invalid links found! 🤖"
update-mode: "replace"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lychee-report
path: ${{ env.LYCHEE_REPORT_FILE }}