Skip to content

Add CI workflow to check for problems with npm configuration files #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/check-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Check npm

env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 10.x

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-npm.ya?ml"
- "**/package.json"
- "**/package-lock.json"
pull_request:
paths:
- ".github/workflows/check-npm.ya?ml"
- "**/package.json"
- "**/package-lock.json"
schedule:
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
- cron: "0 8 * * TUE"
workflow_dispatch:
repository_dispatch:

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Download JSON schema for package.json
id: download-schema
uses: carlosperate/download-file-action@v1
with:
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json
file-url: https://json.schemastore.org/package.json
location: ${{ runner.temp }}/package-json-schema
file-name: package-json-schema.json

- name: Install JSON schema validator
# package.json schema is draft-04, which is not supported by ajv-cli >=4.
run: sudo npm install --global ajv-cli@3.x

- name: Validate GitHub Actions workflows
run: |
# See: https://github.com/ajv-validator/ajv-cli#readme
ajv validate \
-s "${{ steps.download-schema.outputs.file-path }}" \
-d "./**/package.json"

check-sync:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: npm install

- name: Check package-lock.json
run: git diff --color --exit-code package-lock.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Tests Status](https://github.com/arduino/arduino-lint-action/workflows/Test%20Action/badge.svg)](https://github.com/arduino/arduino-lint-action/actions?workflow=Test+Action)
[![Integration Tests Status](https://github.com/arduino/arduino-lint-action/workflows/Integration%20Tests/badge.svg)](https://github.com/arduino/arduino-lint-action/actions?workflow=Integration+Tests)
[![Check Packaging status](https://github.com/arduino/arduino-lint-action/actions/workflows/check-packaging-ncc-typescript-npm.yml/badge.svg)](https://github.com/arduino/arduino-lint-action/actions/workflows/check-packaging-ncc-typescript-npm.yml)
[![Check npm status](https://github.com/arduino/arduino-lint-action/actions/workflows/check-npm.yml/badge.svg)](https://github.com/arduino/arduino-lint-action/actions/workflows/check-npm.yml)
[![Spellcheck Status](https://github.com/arduino/arduino-lint-action/workflows/Spell%20Check/badge.svg)](https://github.com/arduino/arduino-lint-action/actions?workflow=Spell+Check)

[GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions) action that uses
Expand Down
13 changes: 10 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.