Skip to content

Commit b4435a5

Browse files
Handle package files conditions.
1 parent 4a59255 commit b4435a5

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ jobs:
99
runs-on: cx-public-ubuntu-x64
1010
steps:
1111
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
12+
- name: Verify single lockfile (Step 0 - Supply Chain Policy)
13+
run: |
14+
if [ -f yarn.lock ] && [ -f package-lock.json ]; then
15+
echo "❌ ERROR: Both yarn.lock and package-lock.json found. Policy requires exactly ONE package manager. Allowed: npm + package-lock.json OR Yarn + yarn.lock"
16+
exit 1
17+
fi
18+
if [ ! -f yarn.lock ] && [ ! -f package-lock.json ]; then
19+
echo "❌ ERROR: No lockfile found. Policy requires exactly ONE package manager lockfile. Required: npm + package-lock.json OR Yarn + yarn.lock"
20+
exit 1
21+
fi
1222
- name: Use Node.js 22.11.0
1323
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
1424
with:
@@ -22,6 +32,16 @@ jobs:
2232
runs-on: cx-public-ubuntu-x64
2333
steps:
2434
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
35+
- name: Verify single lockfile (Step 0 - Supply Chain Policy)
36+
run: |
37+
if [ -f yarn.lock ] && [ -f package-lock.json ]; then
38+
echo "❌ ERROR: Both yarn.lock and package-lock.json found. Policy requires exactly ONE package manager. Allowed: npm + package-lock.json OR Yarn + yarn.lock"
39+
exit 1
40+
fi
41+
if [ ! -f yarn.lock ] && [ ! -f package-lock.json ]; then
42+
echo "❌ ERROR: No lockfile found. Policy requires exactly ONE package manager lockfile. Required: npm + package-lock.json OR Yarn + yarn.lock"
43+
exit 1
44+
fi
2545
- name: Use Node.js 22.11.0
2646
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
2747
with:

.github/workflows/release.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,17 @@ jobs:
7474
with:
7575
fetch-depth: 0
7676

77-
- name: Git Configuration
77+
- name: Verify single lockfile (Step 0 - Supply Chain Policy)
78+
run: |
79+
if [ -f yarn.lock ] && [ -f package-lock.json ]; then
80+
echo "❌ ERROR: Both yarn.lock and package-lock.json found. Policy requires exactly ONE package manager. Allowed: npm + package-lock.json OR Yarn + yarn.lock"
81+
exit 1
82+
fi
83+
if [ ! -f yarn.lock ] && [ ! -f package-lock.json ]; then
84+
echo "❌ ERROR: No lockfile found. Policy requires exactly ONE package manager lockfile. Required: npm + package-lock.json OR Yarn + yarn.lock"
85+
exit 1
86+
fi
87+
- name: Git Configuration
7888
run: |
7989
git config user.name github-actions
8090
git config user.email github-actions@github.com

0 commit comments

Comments
 (0)