New app #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate JSON | |
on: | |
pull_request_target: | |
paths: | |
- '_data/collection.json' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
schema-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Save PR number | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
run: echo $PR_NUMBER > pr_number | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install dependencies | |
run: | | |
npm install -g ajv-formats | |
npm install -g ajv-cli | |
- name: Run schema check | |
run: | | |
ajv validate -s schema.json -d _data/collection.json --all-errors --errors=text --verbose=true -c=ajv-formats 1>> log.txt 2>&1 | |
- name: Show Validation Issues | |
if: failure() | |
run: cat log.txt | |
- name: Attach Log | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: JSONValidationLog | |
path: log.txt | |
- name: Create artifact for comment | |
if: failure() | |
run: | | |
echo "**The following issues were identified:**" > artifact.txt | |
# Copy to generic name for commenting | |
cat log.txt | tee -a artifact.txt | |
- name: Upload list of issues | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
path: | | |
artifact.txt | |
pr_number |