Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(registry-lint): use jv instead of ajv for clear error output #6

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions registry-lint/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ runs:
echo "packages=${{ steps.changed-packages.outputs.all_changed_files }}" >> "$GITHUB_OUTPUT"
fi

- name: Install jv
uses: mason-org/actions/setup-jv@v1

- name: Validate schema conformance
if: ${{ steps.package-targets.outputs.packages != '' }}
shell: bash
Expand Down
4 changes: 1 addition & 3 deletions registry-lint/validate-schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ fi

set -euo pipefail

npm install -g ajv ajv-cli ajv-formats

SCHEMA_FILE=$(mktemp -t XXXX.json)
curl -fsSL https://github.com/mason-org/registry-schema/releases/latest/download/package.schema.json > "$SCHEMA_FILE"
<<< "$PACKAGES" tr ' ' '\n' | xargs -P10 -I{} ajv validate -d {} -c ajv-formats -s "$SCHEMA_FILE"
<<< "$PACKAGES" tr ' ' '\n' | xargs -P10 -I{} jv -d 7 "$SCHEMA_FILE" {}

for pkg in $PACKAGES; do
# Check if CRLF characters exist in the file
Expand Down
18 changes: 18 additions & 0 deletions setup-jv/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Setup jv
description: Action for setting up jv(JSONSchema Validator). Only supports Linux x64.

inputs:
version:
description: jv version.
required: false
default: v6.0.1

runs:
using: composite
steps:
- name: Install jv
shell: bash
run: |
sudo curl -fL "https://github.com/santhosh-tekuri/jsonschema/releases/download/${{ inputs.version }}/jv-${{ inputs.version }}-linux-amd64.tar.gz" | sudo tar -C /usr/local/bin -xzf -
sudo chmod +x /usr/local/bin/jv