-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathaction.yml
More file actions
75 lines (66 loc) 路 2.31 KB
/
Copy pathaction.yml
File metadata and controls
75 lines (66 loc) 路 2.31 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
71
72
73
74
75
name: "mdschema"
description: "Validate Markdown files against schema definitions"
author: "jackchuka"
branding:
icon: "check-circle"
color: "blue"
inputs:
version:
description: "mdschema version to install. Defaults to the action ref (e.g., @v0.9.1 uses v0.9.1). Use 'latest' to always get the newest release."
required: false
default: ""
files:
description: "Files or glob patterns to validate"
required: false
default: "**/*.md"
schema:
description: "Path to schema file"
required: false
default: ".mdschema.yml"
args:
description: "Additional arguments to pass to mdschema"
required: false
default: ""
working-directory:
description: "Working directory for validation"
required: false
default: "."
runs:
using: "composite"
steps:
- name: Determine version
id: version
shell: bash
run: |
INPUT_VERSION="${{ inputs.version }}"
ACTION_REF="${{ github.action_ref }}"
if [ -n "$INPUT_VERSION" ] && [ "$INPUT_VERSION" != "latest" ]; then
# Use explicitly specified version
VERSION="$INPUT_VERSION"
elif [ -n "$ACTION_REF" ] && [ "$INPUT_VERSION" != "latest" ]; then
# Use action ref (e.g., v0.9.1 from @v0.9.1)
VERSION="$ACTION_REF"
else
# Fallback to latest (for local dev with ./ or explicit 'latest')
VERSION=$(curl -s https://api.github.com/repos/jackchuka/mdschema/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Download mdschema
shell: bash
run: |
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $ARCH in
x86_64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
esac
VERSION="${{ steps.version.outputs.version }}"
VERSION_NUM="${VERSION#v}"
URL="https://github.com/jackchuka/mdschema/releases/download/${VERSION}/mdschema_${VERSION_NUM}_${OS}_${ARCH}.tar.gz"
curl -sL "$URL" | tar xz -C /usr/local/bin mdschema
chmod +x /usr/local/bin/mdschema
- name: Run mdschema check
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
mdschema check ${{ inputs.files }} --schema ${{ inputs.schema }} ${{ inputs.args }}