Skip to content

Commit c5cd2c0

Browse files
committed
Add xmllinter
1 parent a3eb066 commit c5cd2c0

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.github/workflows/test.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ignore": {
3+
"/path/to/file"
4+
}
5+
}

.github/workflows/xmllinter.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
workflow_call:
5+
inputs:
6+
repository:
7+
description: 'The repository that needs linting'
8+
type: string
9+
default: ${{ github.repository }}
10+
required: false
11+
ref:
12+
description: 'The branch, tag or SHA that needs linting'
13+
type: string
14+
required: false
15+
default: ${{ github.ref }}
16+
config_file:
17+
description: 'The location of the linter-configuration'
18+
type: string
19+
required: false
20+
default: ''
21+
workflow_dispatch:
22+
23+
jobs:
24+
linter:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
#- name: "Read JSON"
29+
# uses: actions/github-script@v6
30+
# id: check-env
31+
# with:
32+
# result-encoding: string
33+
# script: |
34+
# try {
35+
# const fs = require('fs')
36+
# const jsonString = fs.readFileSync('./xmllint.json')
37+
# var config = JSON.parse(jsonString)
38+
# } catch(err) {
39+
# core.error("Error while reading or parsing the JSON")
40+
# core.setFailed(err)
41+
# }
42+
43+
- name: Checkout Code
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
repository: ${{ inputs.repository }}
48+
ref: ${{ inputs.ref }}
49+
50+
- name: Read JSON file # this puts the whole JSON file in the read-json step output
51+
id: read-json
52+
run: | # to read multi-line JSON file and not bother with escaping
53+
echo "config<<EOF" >> $GITHUB_OUTPUT
54+
cat ./test.json >> $GITHUB_OUTPUT
55+
echo "EOF" >> $GITHUB_OUTPUT
56+
57+
- name: Lint XML
58+
run: echo ${{fromJson(steps.read-json.outputs.config).ignore }}

0 commit comments

Comments
 (0)