Skip to content

Commit dc57fc0

Browse files
committed
Install referenced schema in "Check npm" workflow
The "Check npm" GitHub Actions workflow validates the repository's `package.json` npm manifest file against its JSON schema to catch any problems with its data format. In order to avoid duplication of content, JSON schemas may reference other schemas via the `$ref` keyword. The `package.json` schema was recently updated to share resources with the `ava.json` schema, which caused the validation to start failing: schema /home/runner/work/_temp/json-schema/package-json-schema.json is invalid error: can't resolve reference https://json.schemastore.org/ava.json from id # The solution is to configure the workflow to download that schema as well and also to provide its path to the avj-cli
1 parent ecd64a4 commit dc57fc0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/check-npm.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ jobs:
4242
location: ${{ runner.temp }}/json-schema
4343
file-name: package-json-schema.json
4444

45+
# This schema is referenced by the package.json schema, so must also be accessible.
46+
- name: Download JSON schema for ava.json
47+
id: download-ava-schema
48+
uses: carlosperate/download-file-action@v1
49+
with:
50+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/ava.json
51+
file-url: https://json.schemastore.org/ava.json
52+
location: ${{ runner.temp }}/json-schema
53+
file-name: ava.json
54+
4555
# This schema is referenced by the package.json schema, so must also be accessible.
4656
- name: Download JSON schema for eslintrc.json
4757
id: download-eslintrc-schema
@@ -71,6 +81,7 @@ jobs:
7181
# See: https://github.com/ajv-validator/ajv-cli#readme
7282
ajv validate \
7383
-s "${{ steps.download-schema.outputs.file-path }}" \
84+
-r "${{ steps.download-ava-schema.outputs.file-path }}" \
7485
-r "${{ steps.download-eslintrc-schema.outputs.file-path }}" \
7586
-r "${{ steps.download-prettierrc-schema.outputs.file-path }}" \
7687
-d "./**/package.json"

0 commit comments

Comments
 (0)