-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (117 loc) · 3.83 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Markdown Lint
concurrency:
group: ${{ github.ref_name }}-markdown
cancel-in-progress: true
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
# Replace pull_request with pull_request_target if you
# plan to use this action with forks, see the Limitations section
pull_request:
branches:
- main
workflow_call:
inputs:
config-links-path:
required: false
default: '.github/config/md-link-config.json'
type: string
config-lint-path:
default: '.github/config/.markdownlint.json'
required: false
type: string
md-lint-globs:
required: false
type: string
default: |
**/*.md
**/*.MD
#.github
#vendor
jobs:
changes:
runs-on: ubuntu-latest
outputs:
files-changed: ${{ steps.filter.outputs.markdown }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
markdown:
- '*.{md,MD}'
- '**/*.{md,MD}'
- '.github/config/.markdownlint.json'
- '.github/config/.prettierignore'
- '.github/config/md-link-config.json'
- '.github/config/spellcheck.yml'
- '.github/config/wordlist.txt'
- '.github/workflows/*.yaml'
markdown:
needs: changes
if: ${{ needs.changes.outputs.files-changed == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_PAT }}
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Prettify MD files
uses: zaphiro-technologies/prettier_action@main
with:
prettier_options: --prose-wrap always --write **/*.{md,MD}
dry: true
dry_no_fail: true
- name: Lint
if: ${{ github.event_name == ' workflow_call' }}
uses: DavidAnson/markdownlint-cli2-action@v11
with:
fix: true
config: ${{ inputs.config-lint-path }}
globs: ${{ inputs.md-lint-globs || '**/*.{md,MD}' }}
- name: Lint
if: ${{ github.event_name != ' workflow_call' }}
uses: DavidAnson/markdownlint-cli2-action@v11
with:
fix: true
config: '.github/config/.markdownlint.json'
globs: ${{ inputs.md-lint-globs || '**/*.{md,MD}' }}
- name: Commit markdown-lint changes
run: |
git config --global user.name 'Bot'
git config --global user.email '[email protected]'
git commit -am "Automated markdown-lint fixes" || echo "No changes to commit"
git push
rm -fr vendor
# Checks the status of hyperlinks in .md files in verbose mode
- name: Check links (.md)
if: ${{ github.event_name == ' workflow_call' }}
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: ${{ inputs.config-link-path }}
use-verbose-mode: 'yes'
- name: Check links (.md)
if: ${{ github.event_name != ' workflow_call' }}
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: '.github/config/md-link-config.json'
use-verbose-mode: 'yes'
- name: Check links (.MD)
if: ${{ github.event_name == ' workflow_call' }}
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: ${{ inputs.config-link-path }}
use-verbose-mode: 'yes'
file-extension: '.MD'
- name: Check links (.MD)
if: ${{ github.event_name != ' workflow_call' }}
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: '.github/config/md-link-config.json'
use-verbose-mode: 'yes'
file-extension: '.MD'