-
Notifications
You must be signed in to change notification settings - Fork 8
50 lines (50 loc) · 1.89 KB
/
validation.yaml
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
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
validate:
name: validate
runs-on: ubuntu-latest
strategy:
matrix:
release: ['alpha', 'beta', 'stable']
steps:
- uses: actions/checkout@v3
# - name: yq valid yaml
# uses: mikefarah/[email protected]
# with:
# cmd: for file in ./${{ matrix.release }}/ok*/*.y*ml; do if ! yq v "$file"; then echo "'${file}' is invalid" && exit 1; fi; done
- name: check for yaml files
id: has-yaml-files
run: |
echo "::set-output name=num-yaml-files::$(find ${{ matrix.release }} -name "*.y*ml" -printf '.' | wc -m | xargs)"
- name: lint ${{ matrix.release }} yaml
if: ${{ steps.has-yaml-files.outputs.num-yaml-files != '0' }}
uses: ibiqlik/[email protected]
with:
file_or_dir: ${{ matrix.release }}/ok*/*.y*ml
# can match with the following: ^(.*):(\d+):(\d+):\s\[(.*)\]\s(.*)$
# for status check annotations in GitHub
format: parsable
- uses: jitterbit/get-changed-files@v1
name: determine file changes
if: ${{ github.event_name == 'pull_request' }}
id: changed-files
with:
format: space-delimited
token: ${{ secrets.GITHUB_TOKEN }}
- name: open knowledge framework validation (pull request)
uses: helpfulengineering/[email protected]
if: ${{ github.event_name == 'pull_request' && steps.has-yaml-files.outputs.num-yaml-files != '0' }}
with:
file-restrictions: ${{ steps.changed-files.outputs.all }}
path: ${{ matrix.release }}/
- name: open knowledge framework validation
uses: helpfulengineering/[email protected]
if: ${{ github.event_name != 'pull_request' && steps.has-yaml-files.outputs.num-yaml-files != '0' }}
with:
path: ${{ matrix.release }}/