Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
70 lines (61 loc) · 1.91 KB
/
Copy pathaction.yml
File metadata and controls
70 lines (61 loc) · 1.91 KB
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
---
name: markdownlint.
description: Run markdownlint-cli2 with repository defaults for reusable workflows.
inputs:
config:
description: Path to markdownlint-cli2 configuration file.
default: ""
required: false
globs:
description: Newline-separated markdownlint-cli2 glob patterns.
default: "**/*.md"
required: false
node-version:
description: Node.js version to use.
default: 24
required: false
version:
description: markdownlint-cli2 version to use.
default: 0.22.1
required: false
runs:
using: composite
steps:
- name: Set up Node.js.
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ inputs.node-version }}
- name: Run markdownlint.
shell: bash
env:
MARKDOWNLINT_CONFIG: ${{ inputs.config }}
MARKDOWNLINT_CLI2_VERSION: ${{ inputs.version }}
MARKDOWNLINT_GLOBS: ${{ inputs.globs }}
run: |
args=()
globs=()
positive_globs=0
if [ -n "$MARKDOWNLINT_CONFIG" ]; then
args+=("--config" "$MARKDOWNLINT_CONFIG")
else
config="$(mktemp -d)/.markdownlint-cli2.jsonc"
cat > "$config" <<'EOF'
{"config":{"MD013":false,"MD033":false}}
EOF
args+=("--config" "$config")
fi
while IFS= read -r glob; do
if [ -n "$glob" ]; then
globs+=("$glob")
if [[ "$glob" != !* && "$glob" != \#* ]]; then
positive_globs=$((positive_globs + 1))
fi
fi
done <<< "$MARKDOWNLINT_GLOBS"
if [ "$positive_globs" -eq 0 ]; then
echo "No markdownlint glob patterns configured; skipping."
exit 0
fi
globs+=("#.php-forge-actions/**")
npm exec --yes --package "markdownlint-cli2@$MARKDOWNLINT_CLI2_VERSION" -- \
markdownlint-cli2 "${args[@]}" "${globs[@]}"