-
Notifications
You must be signed in to change notification settings - Fork 278
49 lines (47 loc) · 1.82 KB
/
validate-definition.yml
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
name: validate entity synthesis definitions
on:
pull_request_target:
branches:
- main
permissions:
pull-requests: write
jobs:
validate:
name: Validation
runs-on: ubuntu-latest
env:
RELATIONSHIPS_SYNTHESIS_DIR: ../prcode/relationships/synthesis/
DEFINITIONS_DIR: ../prcode/entity-types/
steps:
- name: Checkout code from base branch
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Checkout PR code (merged version with base branch)
uses: actions/checkout@v4
with:
ref: "${{ github.event.pull_request.merge_commit_sha }}"
path: "prcode"
persist-credentials: false
if: ${{ github.event.pull_request.mergeable == true }}
- name: Checkout PR code (latest PR commit if merged version is not available)
uses: actions/checkout@v4
with:
ref: "${{ github.event.pull_request.head.sha }}"
path: "prcode"
persist-credentials: false
if: ${{ github.event.pull_request.mergeable != true }} # If the PR is not mergeable, or it's mergeability it's yet not calculated
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm --prefix validator install
- name: Validate definition
run: npm --prefix validator run check-pr
env:
PR_NUMBER: ${{ github.event.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure sanitize was run
# Runs the sanitize script and checks errors if the dashboards were not sanitized.
# If the dashboards were sanitized, the git command will return 0 and the step will pass.
run: npm --prefix validator run sanitize-dashboards && git -C prcode diff-index --quiet HEAD -- entity-types/