-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
44 lines (41 loc) · 1.76 KB
/
action.yml
File metadata and controls
44 lines (41 loc) · 1.76 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
name: DTDL Validator action
description: Validate DTDL files inside a folder
inputs:
folder:
description: 'The folder in whitch the dtdl files are stored'
default: '.'
required: false
recursive:
description: 'If it is set to true then it will perform a recursive search starting from the provided folder'
default: false
required: false
runs:
using: composite
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
path: repo
submodules: recursive
fetch-depth: 0
- name: Setup DotNet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.1.x
- name: Get the Microsoft DTDL Validator software
uses: actions/checkout@v4
with:
path: dtdl-microsoft-validator
repository: Azure-Samples/DTDL-Validator
# Need to checkout the SHA of the commit because the last tag (209128) has a bug in recursive mode and they haven't created a new one when solved.
# This solution is more stable with respect to referring to the master branch (can be updated and no tests are performed automatically against it).
ref: 'fc2875d9b64570ca5b16d49123f8c76c9381b14a'
- name: Validate the files
shell: bash
run: dotnet run --property WarningLevel=0 --project dtdl-microsoft-validator/DTDLValidator-Sample/DTDLValidator/ ${{ inputs.recursive == 'true' && '--recursive' || ' ' }} -d repo/${{ inputs.folder }} > validation-result.txt
- name: Echo the result of the validation
shell: bash
run: cat validation-result.txt
- name: Set the return code
shell: bash
run: (cat validation-result.txt | grep "No matching files found" || cat validation-result.txt | grep "Validated all files - Your DTDL is valid") &> /dev/null