-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
113 lines (106 loc) · 3.71 KB
/
Copy pathaction.yml
File metadata and controls
113 lines (106 loc) · 3.71 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
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
name: 'Structured MADR Validator'
description: 'Validates Architectural Decision Records against the Structured MADR specification'
author: 'zircote'
branding:
icon: 'check-circle'
color: 'green'
inputs:
mode:
description: "Validation mode: 'smadr' (structured-MADR frontmatter) or 'mif' (MIF conformance projection)"
required: false
default: 'smadr'
mif-level:
description: 'MIF conformance level override (1|2|3). If empty, read from mif-config.'
required: false
default: ''
mif-config:
description: 'Path to the MIF config (relative to the consumer repo)'
required: false
default: '.github/config.yml'
path:
description: 'Path to the directory containing ADR files (relative to repository root)'
required: false
default: 'docs/decisions'
pattern:
description: 'Glob pattern for ADR files'
required: false
default: '**/*.md'
schema:
description: 'Path to custom JSON Schema (uses built-in schema if not specified)'
required: false
default: ''
strict:
description: 'Enable strict mode (fail on warnings)'
required: false
default: 'false'
fail-on-error:
description: 'Fail the workflow if validation errors are found'
required: false
default: 'true'
outputs:
valid:
description: 'Whether all ADRs passed validation'
value: ${{ steps.validate.outputs.valid }}
total:
description: 'Total number of ADR files checked'
value: ${{ steps.validate.outputs.total }}
passed:
description: 'Number of ADR files that passed validation'
value: ${{ steps.validate.outputs.passed }}
failed:
description: 'Number of ADR files that failed validation'
value: ${{ steps.validate.outputs.failed }}
warnings:
description: 'Number of warnings generated'
value: ${{ steps.validate.outputs.warnings }}
mif-valid:
description: 'MIF mode: whether all ADRs passed MIF conformance'
value: ${{ steps.mif.outputs.mif-valid }}
mif-total:
description: 'MIF mode: total ADRs checked'
value: ${{ steps.mif.outputs.mif-total }}
mif-passed:
description: 'MIF mode: ADRs that passed MIF conformance'
value: ${{ steps.mif.outputs.mif-passed }}
mif-failed:
description: 'MIF mode: ADRs that failed MIF conformance'
value: ${{ steps.mif.outputs.mif-failed }}
runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24'
- name: Install dependencies
shell: bash
working-directory: ${{ github.action_path }}
run: npm ci --ignore-scripts
- name: Run validation
id: validate
if: ${{ inputs.mode != 'mif' }}
shell: bash
env:
INPUT_PATH: ${{ inputs.path }}
INPUT_PATTERN: ${{ inputs.pattern }}
INPUT_SCHEMA: ${{ inputs.schema }}
INPUT_STRICT: ${{ inputs.strict }}
INPUT_FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
ACTION_PATH: ${{ github.action_path }}
run: |
node "$ACTION_PATH/src/validate.js"
- name: Run MIF conformance validation
id: mif
if: ${{ inputs.mode == 'mif' }}
shell: bash
env:
GITHUB_ACTION_PATH: ${{ github.action_path }}
INPUT_PATH: ${{ inputs.path }}
INPUT_PATTERN: ${{ inputs.pattern }}
INPUT_MIF_CONFIG: ${{ inputs.mif-config }}
INPUT_MIF_LEVEL: ${{ inputs.mif-level }}
run: |
# MIF mode is fail-closed (error-only); `strict` does not apply here.
args=(--path "$INPUT_PATH" --pattern "$INPUT_PATTERN" --config "$INPUT_MIF_CONFIG")
if [ -n "$INPUT_MIF_LEVEL" ]; then args+=(--level "$INPUT_MIF_LEVEL"); fi
node "$GITHUB_ACTION_PATH/.github/bin/mif-validate.js" "${args[@]}"