From 988bd0d5b4bcdfc14d539a362cfee2cb08c856e5 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 31 Oct 2022 02:24:33 -0700 Subject: [PATCH] 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. --- .github/workflows/check-npm.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/check-npm.yml b/.github/workflows/check-npm.yml index d789201..576610e 100644 --- a/.github/workflows/check-npm.yml +++ b/.github/workflows/check-npm.yml @@ -72,6 +72,16 @@ jobs: location: ${{ runner.temp }}/json-schema file-name: jscpd-schema.json + # This schema is referenced by the package.json schema, so must also be accessible. + - name: Download JSON schema for Prettier configuration file + id: download-npm-badges-schema + uses: carlosperate/download-file-action@v2 + with: + # See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/npm-badges.json + file-url: https://json.schemastore.org/npm-badges.json + location: ${{ runner.temp }}/json-schema + file-name: npm-badges-schema.json + # This schema is referenced by the package.json schema, so must also be accessible. - name: Download JSON schema for Prettier configuration file id: download-prettierrc-schema @@ -114,6 +124,7 @@ jobs: -r "${{ steps.download-ava-schema.outputs.file-path }}" \ -r "${{ steps.download-eslintrc-schema.outputs.file-path }}" \ -r "${{ steps.download-jscpd-schema.outputs.file-path }}" \ + -r "${{ steps.download-npm-badges-schema.outputs.file-path }}" \ -r "${{ steps.download-prettierrc-schema.outputs.file-path }}" \ -r "${{ steps.download-semantic-release-schema.outputs.file-path }}" \ -r "${{ steps.download-stylelintrc-schema.outputs.file-path }}" \