-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
99 lines (93 loc) · 3.26 KB
/
Copy pathaction.yml
File metadata and controls
99 lines (93 loc) · 3.26 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
name: 'FHIR Validator'
description: 'Validate FHIR R4/R4B/R5/R6 JSON resources with the Records TypeScript validator.'
author: 'medvertical'
branding:
icon: 'check-circle'
color: 'blue'
inputs:
paths:
description: >-
Glob pattern(s) of FHIR JSON files to validate. Newline- or
comma-separated. Example: `examples/**/*.json,test/fixtures/*.json`.
required: true
profile-url:
description: >-
Canonical profile URL to validate every resource against. When
omitted, each resource is validated against the base SD for its
resourceType (`http://hl7.org/fhir/StructureDefinition/<type>`).
required: false
default: ''
fhir-version:
description: 'FHIR version: R4, R4B, R5, or R6.'
required: false
default: 'R4'
fail-on:
description: >-
Severity level that fails the build. One of: `error` (default),
`warning`, `none`. With `none` the action never fails — useful for
reporting-only runs.
required: false
default: 'error'
output-file:
description: >-
Optional path to write the aggregated JSON result. Each entry
carries `{ file, resourceType, issues }`.
required: false
default: ''
validator-version:
description: >-
npm version range for `@records-fhir/validator`. Defaults to
`latest`. Pin to a specific minor for reproducible CI.
required: false
default: 'latest'
log-level:
description: >-
Engine log level: `debug`, `info`, `warn` (default), `error`, or
`silent`. The default keeps CI output focused on validation
annotations; raise to `info`/`debug` when debugging.
required: false
default: 'warn'
outputs:
issue-count:
description: 'Total number of issues emitted across all validated files.'
value: ${{ steps.validate.outputs.issue-count }}
error-count:
description: 'Number of `error`-severity issues.'
value: ${{ steps.validate.outputs.error-count }}
warning-count:
description: 'Number of `warning`-severity issues.'
value: ${{ steps.validate.outputs.warning-count }}
runs:
using: composite
steps:
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '20'
- name: Install @records-fhir/validator
shell: bash
env:
VALIDATOR_VERSION: ${{ inputs.validator-version }}
run: |
set -euo pipefail
node -e '
const version = process.env.VALIDATOR_VERSION ?? "";
if (version.length === 0 || version.length > 100 || !/^[0-9A-Za-z*^~<>=|.+ -]+$/.test(version)) {
console.error("validator-version must be an npm tag or semver range");
process.exit(1);
}
'
npm install --no-save --no-audit --no-fund \
-- "@records-fhir/validator@${VALIDATOR_VERSION}"
- name: Run validator
id: validate
shell: bash
env:
INPUT_PATHS: ${{ inputs.paths }}
INPUT_PROFILE_URL: ${{ inputs.profile-url }}
INPUT_FHIR_VERSION: ${{ inputs.fhir-version }}
INPUT_FAIL_ON: ${{ inputs.fail-on }}
INPUT_OUTPUT_FILE: ${{ inputs.output-file }}
INPUT_LOG_LEVEL: ${{ inputs.log-level }}
ACTION_PATH: ${{ github.action_path }}
run: node "${ACTION_PATH}/action-run.mjs"