-
-
Notifications
You must be signed in to change notification settings - Fork 59
68 lines (59 loc) · 2.13 KB
/
links.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
name: Links
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: "00 18 * * *"
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: "gh-pages"
- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
args: --verbose --no-progress **/*.html
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Lychee's exit code
## https://github.com/lycheeverse/lychee#exit-codes
run: echo Lychee exit with ${{ steps.lychee.outputs.exit_code }}
- name: Find the last open report issue
id: last_issue
uses: micalevisk/last-issue-action@v2
with:
state: open
## The issue must have the following labels
labels: report, automated issue
env:
## Optional since it uses the `GITHUB_TOKEN` created by GitHub by default
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create an issue from report file
if: >-
steps.last_issue.outputs.has_found == 'false' &&
steps.lychee.outputs.exit_code != 0
uses: peter-evans/create-issue-from-file@v5
with:
title: Link checker report
content-filepath: /tmp/lychee/out.md
issue-number: ${{ steps.last_issue.outputs.issue_number }}
labels: report, automated issue
- run: echo ${{ steps.last_issue.outputs.issue_number }}
- name: Update last report open issue created
if: ${{ steps.last_issue.outputs.has_found == 'true' }}
uses: peter-evans/create-issue-from-file@v5
with:
title: Link checker report
content-filepath: /tmp/lychee/out.md
issue-number: ${{ steps.last_issue.outputs.issue_number }}
labels: report, automated issue
- name: Close the last report open issue
if: >-
steps.last_issue.outputs.has_found == 'true' &&
steps.lychee.outputs.exit_code == 0
uses: peter-evans/close-issue@v2
with:
issue-number: ${{ steps.last_issue.outputs.issue_number }}