-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (81 loc) · 2.96 KB
/
markdown.yaml
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
name: "Markdown"
on:
push:
branches:
- "main"
paths:
- "**.md"
pull_request:
paths:
- "**.md"
schedule:
- cron: "0 0 */2 * *"
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
SEARCH_PATTERN: "**.md"
jobs:
linter:
name: "Linter"
if: "${{ github.event_name == 'push' || github.event_name == 'pull_request' }}"
runs-on: "${{ vars.DEFAULT_UBUNTU }}"
steps:
- name: "Set up repository with all history"
uses: "actions/checkout@v4.1.2"
with:
fetch-depth: 0
- name: "Get all changed files"
id: "markdown-files"
uses: "tj-actions/changed-files@v44.1.0"
with:
files: "${{ env.SEARCH_PATTERN }}"
- name: "Run linter for all changed files"
uses: "DavidAnson/markdownlint-cli2-action@v16.0.0"
with:
globs: "${{ steps.markdown-files.outputs.all_changed_files }}"
link-checker:
name: "Link checker"
runs-on: "${{ vars.DEFAULT_UBUNTU }}"
env:
IS_PUSH_EVENT: "${{ github.event_name == 'push' }}"
IS_PUSH_OR_PULL_REQUEST_EVENT: "${{ github.event_name == 'push' || github.event_name == 'pull_request' }}"
IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT: "${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}"
steps:
- name: "Set up repository with all history"
if: "${{ env.IS_PUSH_OR_PULL_REQUEST_EVENT == vars.POSITIVE }}"
uses: "actions/checkout@v4.1.2"
with:
fetch-depth: 0
- name: "Set up repository with the latest commit"
if: "${{ env.IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT == vars.POSITIVE }}"
uses: "actions/checkout@v4.1.2"
- name: "Get all changed files"
id: "markdown-files"
if: "${{ env.IS_PUSH_OR_PULL_REQUEST_EVENT == vars.POSITIVE }}"
uses: "tj-actions/changed-files@v44.1.0"
with:
files: "${{ env.SEARCH_PATTERN }}"
- name: "Run link checker for all changed files"
if: "${{ env.IS_PUSH_OR_PULL_REQUEST_EVENT == vars.POSITIVE }}"
uses: "lycheeverse/lychee-action@v1.9.3"
with:
args: "${{ steps.markdown-files.outputs.all_changed_files }}"
fail: true
- name: "Run link checker for all files"
if: "${{ env.IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT == vars.POSITIVE }}"
uses: "lycheeverse/lychee-action@v1.9.3"
with:
args: "'**/*.md'"
fail: true
- name: "Create issue if inaccessible links are found"
if: "${{ (env.IS_PUSH_EVENT == vars.POSITIVE || env.IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT == vars.POSITIVE) && failure() }}"
uses: "peter-evans/create-issue-from-file@v5.0.0"
with:
title: "Inaccessible Markdown links found"
assignees: "${{ github.repository_owner }}"
labels: |
priority: medium
status: pending
content-filepath: "lychee/out.md"