Skip to content

Commit d19f46d

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 jscpd configuration 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/jscpd.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 validator via an `-r` flag.
1 parent e2d91c3 commit d19f46d

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
@@ -62,6 +62,16 @@ jobs:
6262
location: ${{ runner.temp }}/json-schema
6363
file-name: eslintrc-schema.json
6464

65+
# This schema is referenced by the package.json schema, so must also be accessible.
66+
- name: Download JSON schema for jscpd configuration file
67+
id: download-jscpd-schema
68+
uses: carlosperate/download-file-action@v1
69+
with:
70+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/jscpd.json
71+
file-url: https://json.schemastore.org/jscpd.json
72+
location: ${{ runner.temp }}/json-schema
73+
file-name: jscpd-schema.json
74+
6575
# This schema is referenced by the package.json schema, so must also be accessible.
6676
- name: Download JSON schema for Prettier configuration file
6777
id: download-prettierrc-schema
@@ -103,6 +113,7 @@ jobs:
103113
-s "${{ steps.download-schema.outputs.file-path }}" \
104114
-r "${{ steps.download-ava-schema.outputs.file-path }}" \
105115
-r "${{ steps.download-eslintrc-schema.outputs.file-path }}" \
116+
-r "${{ steps.download-jscpd-schema.outputs.file-path }}" \
106117
-r "${{ steps.download-prettierrc-schema.outputs.file-path }}" \
107118
-r "${{ steps.download-semantic-release-schema.outputs.file-path }}" \
108119
-r "${{ steps.download-stylelintrc-schema.outputs.file-path }}" \

0 commit comments

Comments
 (0)