forked from ivankatliarchuk/.github
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (80 loc) · 2.35 KB
/
governance.links-checker.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
# @todo: sync with other repositories
---
name: governance.link-checker
# Run action on pull request event
on:
push:
branches:
- $default-branch
paths:
- '*.md'
pull_request:
types: [opened, edited]
paths:
- '*.md'
schedule:
- cron: "0 9 * * 1"
workflow_dispatch:
env:
TEMPLATE: .github/templates/issue.links.md
LYCHEE_OUT: out.md
USER_AGENT: "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
jobs:
markdown-link-check:
runs-on: ubuntu-latest
if: github.repository == 'ivankatliarchuk/.github'
steps:
# checkout to latest commit
- uses: actions/[email protected]
# run markdown linter
# todo https://github.com/peter-evans/link-checker
- name: link checker
id: lychee
uses: lycheeverse/[email protected]
# if: failure()
with:
args: >
--exclude="^(javascript|chrome):.*"
--exclude "^git"
--exclude "^file://"
--verbose
--no-progress
--accept=200,403,429
--timeout 20
"*.md"
"**/*.md"
"README.md"
"*.toml"
"**/*.toml"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: read output
id: readfile
uses: juliangruber/[email protected]
if: ${{ steps.lychee.outputs.exit_code > 0 }}
with:
path: ${{ env.LYCHEE_OUT }}
- name: results
id: read
run: |
echo "exit code: ${{ steps.lychee.outputs.exit_code }}"
- name: update issue template
uses: DamianReeves/write-file-action@master
if: ${{ steps.lychee.outputs.exit_code > 0 }}
with:
path: .github/templates/issue.links.md
contents: ${{ steps.readfile.outputs.content }}
write-mode: append
- name: create issue from file
uses: JasonEtco/[email protected]
id: issue
if: ${{ steps.lychee.outputs.exit_code > 0 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: 'Markdwon links checker'
with:
filename: ${{ env.TEMPLATE }}
assignees: ${{ github.repository_owner }}
update_existing: true
- name: fail if there were link errors
run: exit ${{ steps.lychee.outputs.exit_code }}