FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docs/.github/workflows/package-lock-lint.yml at main · basiclines/docs · GitHub
basiclines
/
docs
Public
forked from
github/docs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
docs
/
.github
/
workflows
/
package-lock-lint.yml
Copy path
View runs
More file actions
More file actions
Latest commit
History
History
History
63 lines (51 loc) · 2.38 KB
Breadcrumbs
docs
/
.github
/
workflows
/
package-lock-lint.yml
Copy path
File metadata and controls
63 lines (51 loc) · 2.38 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name
:
Package lock lint
#
**What it does**: Makes sure package.json and package-lock.json is in sync
#
**Why we have it**: Accidental manual edits of the dependencies directly in package.json
#
**Who does it impact**: Docs engineering/writers/contributors.
on
:
pull_request
:
paths
:
-
package.json
-
package-lock.json
-
.github/workflows/package-lock-lint.yml
permissions
:
contents
:
read
#
This allows a subsequently queued workflow run to interrupt previous runs
concurrency
:
group
:
'
${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
'
cancel-in-progress
:
true
jobs
:
lint
:
runs-on
:
ubuntu-latest
if
:
github.repository == 'github/docs-internal' || github.repository == 'github/docs'
steps
:
-
name
:
Check out repo
uses
:
actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
#
v6.0.1
-
name
:
Setup Node.js
uses
:
actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903
#
v6.0.0
with
:
node-version-file
:
'
package.json
'
cache
:
npm
-
name
:
Run check
run
:
|
npm --version
# Save the current top-level dependencies from package-lock.json
node -e "console.log(JSON.stringify(require('./package-lock.json').packages['']))" > /tmp/before.json
# From https://docs.npmjs.com/cli/v7/commands/npm-install
#
# The --package-lock-only argument will only update the
# package-lock.json, instead of checking node_modules and
# downloading dependencies.
#
npm install --package-lock-only --ignore-scripts --include=optional
# Extract the top-level dependencies after regeneration
node -e "console.log(JSON.stringify(require('./package-lock.json').packages['']))" > /tmp/after.json
# Compare only the top-level package dependencies
# This ignores platform-specific differences in nested dependency resolution
# (like "peer" flags) that don't affect actual installed versions
if ! diff /tmp/before.json /tmp/after.json; then
echo "ERROR: Top-level dependencies in package-lock.json are out of sync with package.json"
echo "Please run 'npm install' locally and commit the updated package-lock.json"
exit 1
fi
echo "✓ Top-level dependencies are in sync"
Back
|
FazBrowse Home
|
New Git URL