-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (55 loc) · 2.04 KB
/
workflow-markdown-check.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 Markdown conformance to AI Lab standards
on:
workflow_call:
inputs:
md-link-config-file-path:
required: false
type: string
md-lint-config-file-path:
required: false
type: string
push:
jobs:
markdown-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Checkout reusable workflows repository for default configs if needed
- name: Checkout default configs
if: inputs.md-link-config-file-path == '' || inputs.md-lint-config-file-path == ''
uses: actions/checkout@v4
with:
repository: ai-cfia/github-workflows
path: github-workflows
ref: 89-fix-option-to-markdown-check-does-nothing-and-may-be-hiding-actual-errors
sparse-checkout: |
.markdownlint.json
.mlc_config.json
sparse-checkout-cone-mode: false
- name: Determine markdown link config file
id: linkconfig
run: |
if [ -z "${{ inputs.md-link-config-file-path }}" ]; then
echo "::set-output name=link_config_path::github-workflows/.mlc_config.json"
else
echo "::set-output name=link_config_path::${{ inputs.md-link-config-file-path }}"
fi
- name: Determine markdown lint config file
id: lintconfig
run: |
if [ -z "${{ inputs.md-lint-config-file-path }}" ]; then
echo "::set-output name=lint_config_path::github-workflows/.markdownlint.json"
else
echo "::set-output name=lint_config_path::${{ inputs.md-lint-config-file-path }}"
fi
- name: Validating links
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: ${{ steps.linkconfig.outputs.link_config_path }}
- name: Run markdown lint
uses: DavidAnson/markdownlint-cli2-action@v14
if: always()
with:
globs: '**/*.md'
config: ${{ github.workspace }}/${{ steps.lintconfig.outputs.lint_config_path }}