Skip to content

Commit 988bd0d

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/npm-badges.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 3190bbe commit 988bd0d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/check-npm.yml

+11
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ jobs:
7272
location: ${{ runner.temp }}/json-schema
7373
file-name: jscpd-schema.json
7474

75+
# This schema is referenced by the package.json schema, so must also be accessible.
76+
- name: Download JSON schema for Prettier configuration file
77+
id: download-npm-badges-schema
78+
uses: carlosperate/download-file-action@v2
79+
with:
80+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/npm-badges.json
81+
file-url: https://json.schemastore.org/npm-badges.json
82+
location: ${{ runner.temp }}/json-schema
83+
file-name: npm-badges-schema.json
84+
7585
# This schema is referenced by the package.json schema, so must also be accessible.
7686
- name: Download JSON schema for Prettier configuration file
7787
id: download-prettierrc-schema
@@ -114,6 +124,7 @@ jobs:
114124
-r "${{ steps.download-ava-schema.outputs.file-path }}" \
115125
-r "${{ steps.download-eslintrc-schema.outputs.file-path }}" \
116126
-r "${{ steps.download-jscpd-schema.outputs.file-path }}" \
127+
-r "${{ steps.download-npm-badges-schema.outputs.file-path }}" \
117128
-r "${{ steps.download-prettierrc-schema.outputs.file-path }}" \
118129
-r "${{ steps.download-semantic-release-schema.outputs.file-path }}" \
119130
-r "${{ steps.download-stylelintrc-schema.outputs.file-path }}" \

0 commit comments

Comments
 (0)