-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
146 lines (146 loc) · 6.51 KB
/
Copy pathaction.yml
File metadata and controls
146 lines (146 loc) · 6.51 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: XML Model Validator
description: Validate xml-model XML with Relax NG and Schematron for TEI, DocBook, JATS, and other complex XML workflows
author: Andrew Dunning
branding:
icon: check-circle
color: blue
outputs:
skipped:
description: Whether validation was skipped because no changed files matched the configured extensions
value: ${{ steps.validate.outputs.skipped }}
files_checked:
description: Number of files checked during validation
value: ${{ steps.validate.outputs.files_checked }}
failed_files:
description: Number of files that failed validation
value: ${{ steps.validate.outputs.failed_files }}
warning_count:
description: Number of warning-level issues produced during validation
value: ${{ steps.validate.outputs.warning_count }}
json_report_path:
description: Absolute path to the saved JSON report when json_report_path input is set
value: ${{ steps.validate.outputs.json_report_path }}
inputs:
files:
description: Newline-delimited list of files to validate explicitly
required: false
files_from:
description: Path to a newline-delimited file list
required: false
directory:
description: Directory containing matching files to validate recursively
required: false
file_extensions:
description: Comma- or whitespace-separated file extensions to discover when scanning directories or changed files; a leading period is optional
required: false
changed_files_only:
description: Validate only changed files with matching extensions from the current push or pull request
required: false
default: "false"
changed_source:
description: Source for changed_files_only file discovery (auto, api, git)
required: false
default: "auto"
jobs:
description: Number of parallel workers to use (0 = auto)
required: false
default: "0"
config:
description: Optional path to a TOML validator config file containing schema aliases and xml-model rules
required: false
xml_model_rule_mode:
description: Optional inline xml-model rule mode for this run (fallback or replace)
required: false
xml_model_rule_directory:
description: Optional directory scope for the inline xml-model rule; when no selection input is set, this also becomes the default directory to validate
required: false
xml_model_rule_extension:
description: Optional file extension scope for the inline xml-model rule; a leading period is optional
required: false
xml_model_declarations:
description: Optional newline-delimited xml-model declarations for one inline rule; repeat lines to validate against multiple schemas
required: false
fail_fast:
description: Stop after the first file that fails validation
required: false
default: "false"
check_schematron_schema:
description: Run SchXslt assembled-schema checks before validating documents that use Schematron
required: false
default: "false"
schematron_severity_threshold:
description: Skip Schematron assertions with a severity lower than this threshold; one of INFO, WARNING, ERROR, FATAL
required: false
default: "INFO"
json_report_path:
description: Optional path, relative to the repository root or absolute, where the Action should save a JSON validation report
required: false
runs:
using: composite
steps:
- name: Restore Validator Runtime Cache
id: restore-runtime-cache
uses: actions/cache/restore@v5
with:
path: |
~/.cache/xml-model-validator/schema-downloads
~/.cache/xml-model-validator/schematron
key: xml-model-validator-runtime-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
xml-model-validator-runtime-${{ runner.os }}-
- name: Restore Validator JAR Cache
id: restore-jar-cache
uses: actions/cache/restore@v5
with:
path: ~/.cache/xml-model-validator/jar
key: xml-model-validator-jar-${{ runner.os }}-${{ github.action_ref }}
- name: Set Up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "25"
- name: Set Up Gradle
if: steps.restore-jar-cache.outputs.cache-hit != 'true'
uses: gradle/actions/setup-gradle@v6
with:
add-job-summary: on-failure
- name: Validate XML
id: validate
shell: bash
working-directory: ${{ github.action_path }}
env:
XML_MODEL_VALIDATOR_WORKSPACE: ${{ github.workspace }}
XML_MODEL_VALIDATOR_INPUT_FILES: ${{ inputs.files }}
XML_MODEL_VALIDATOR_INPUT_FILES_FROM: ${{ inputs.files_from }}
XML_MODEL_VALIDATOR_INPUT_DIRECTORY: ${{ inputs.directory }}
XML_MODEL_VALIDATOR_INPUT_FILE_EXTENSIONS: ${{ inputs.file_extensions }}
XML_MODEL_VALIDATOR_INPUT_CHANGED_FILES_ONLY: ${{ inputs.changed_files_only }}
XML_MODEL_VALIDATOR_INPUT_CHANGED_SOURCE: ${{ inputs.changed_source }}
XML_MODEL_VALIDATOR_INPUT_JOBS: ${{ inputs.jobs }}
XML_MODEL_VALIDATOR_INPUT_CONFIG: ${{ inputs.config }}
XML_MODEL_VALIDATOR_INPUT_XML_MODEL_RULE_MODE: ${{ inputs.xml_model_rule_mode }}
XML_MODEL_VALIDATOR_INPUT_XML_MODEL_RULE_DIRECTORY: ${{ inputs.xml_model_rule_directory }}
XML_MODEL_VALIDATOR_INPUT_XML_MODEL_RULE_EXTENSION: ${{ inputs.xml_model_rule_extension }}
XML_MODEL_VALIDATOR_INPUT_XML_MODEL_DECLARATIONS: ${{ inputs.xml_model_declarations }}
XML_MODEL_VALIDATOR_INPUT_FAIL_FAST: ${{ inputs.fail_fast }}
XML_MODEL_VALIDATOR_INPUT_CHECK_SCHEMATRON_SCHEMA: ${{ inputs.check_schematron_schema }}
XML_MODEL_VALIDATOR_INPUT_SCHEMATRON_SEVERITY_THRESHOLD: ${{ inputs.schematron_severity_threshold }}
XML_MODEL_VALIDATOR_INPUT_JSON_REPORT_PATH: ${{ inputs.json_report_path }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
bash "${{ github.action_path }}/entrypoint.sh"
- name: Save Validator JAR Cache
if: always() && steps.restore-jar-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ~/.cache/xml-model-validator/jar
key: xml-model-validator-jar-${{ runner.os }}-${{ github.action_ref }}
- name: Save Validator Runtime Cache
if: always() && steps.restore-runtime-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: |
~/.cache/xml-model-validator/schema-downloads
~/.cache/xml-model-validator/schematron
key: xml-model-validator-runtime-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}