Skip to content

Commit 64a6d36

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 npm-badges 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/partial-eslint-plugins.json from id https://json.schemastore.org/eslintrc.json# 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 a `-r` flag.
1 parent 9d91495 commit 64a6d36

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
@@ -82,6 +82,16 @@ jobs:
8282
location: ${{ runner.temp }}/json-schema
8383
file-name: npm-badges-schema.json
8484

85+
# This schema is referenced by the package.json schema, so must also be accessible.
86+
- name: Download JSON schema for ESLint plugins
87+
id: download-partial-eslint-plugins-schema
88+
uses: carlosperate/download-file-action@v2
89+
with:
90+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/partial-eslint-plugins.json
91+
file-url: https://json.schemastore.org/partial-eslint-plugins.json
92+
location: ${{ runner.temp }}/json-schema
93+
file-name: partial-eslint-plugins.json
94+
8595
# This schema is referenced by the package.json schema, so must also be accessible.
8696
- name: Download JSON schema for Prettier configuration file
8797
id: download-prettierrc-schema
@@ -125,6 +135,7 @@ jobs:
125135
-r "${{ steps.download-eslintrc-schema.outputs.file-path }}" \
126136
-r "${{ steps.download-jscpd-schema.outputs.file-path }}" \
127137
-r "${{ steps.download-npm-badges-schema.outputs.file-path }}" \
138+
-r "${{ steps.download-partial-eslint-plugins-schema.outputs.file-path }}" \
128139
-r "${{ steps.download-prettierrc-schema.outputs.file-path }}" \
129140
-r "${{ steps.download-semantic-release-schema.outputs.file-path }}" \
130141
-r "${{ steps.download-stylelintrc-schema.outputs.file-path }}" \

0 commit comments

Comments
 (0)