Skip to content

Commit cd91005

Browse files
authored
Merge pull request #31 from per1234/check-npm
Add CI workflow to check for problems with npm configuration files
2 parents 752b69d + b006d81 commit cd91005

File tree

3 files changed

+80
-3
lines changed

3 files changed

+80
-3
lines changed

.github/workflows/check-npm.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Check npm
2+
3+
env:
4+
# See: https://github.com/actions/setup-node/#readme
5+
NODE_VERSION: 10.x
6+
7+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
8+
on:
9+
push:
10+
paths:
11+
- ".github/workflows/check-npm.ya?ml"
12+
- "**/package.json"
13+
- "**/package-lock.json"
14+
pull_request:
15+
paths:
16+
- ".github/workflows/check-npm.ya?ml"
17+
- "**/package.json"
18+
- "**/package-lock.json"
19+
schedule:
20+
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
21+
- cron: "0 8 * * TUE"
22+
workflow_dispatch:
23+
repository_dispatch:
24+
25+
jobs:
26+
validate:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v2
32+
33+
- name: Download JSON schema for package.json
34+
id: download-schema
35+
uses: carlosperate/download-file-action@v1
36+
with:
37+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json
38+
file-url: https://json.schemastore.org/package.json
39+
location: ${{ runner.temp }}/package-json-schema
40+
file-name: package-json-schema.json
41+
42+
- name: Install JSON schema validator
43+
# package.json schema is draft-04, which is not supported by ajv-cli >=4.
44+
run: sudo npm install --global [email protected]
45+
46+
- name: Validate GitHub Actions workflows
47+
run: |
48+
# See: https://github.com/ajv-validator/ajv-cli#readme
49+
ajv validate \
50+
-s "${{ steps.download-schema.outputs.file-path }}" \
51+
-d "./**/package.json"
52+
53+
check-sync:
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Checkout repository
58+
uses: actions/checkout@v2
59+
60+
- name: Setup Node.js
61+
uses: actions/setup-node@v2
62+
with:
63+
node-version: ${{ env.NODE_VERSION }}
64+
65+
- name: Install dependencies
66+
run: npm install
67+
68+
- name: Check package-lock.json
69+
run: git diff --color --exit-code package-lock.json

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![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)
44
[![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)
55
[![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)
6+
[![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)
67
[![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)
78

89
[GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions) action that uses

package-lock.json

Lines changed: 10 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)