Skip to content

Commit b8740f4

Browse files
committed
ci: add conditional lockfile validation based on PR label
- Add label-based check to allow lockfile changes in specific PRs - Use 'allow-lockfile-changes' label to bypass hardened mode - Maintains strict lockfile validation for regular PRs - Keep hardened mode enabled by default for security
1 parent b0d2fed commit b8740f4

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,26 @@ jobs:
4646
restore-keys: |
4747
${{ runner.os }}-node-modules-
4848
49-
- name: 📥 Install dependencies
49+
- name: 🔍 Check if PR allows lockfile changes
50+
id: check-label
51+
if: github.event_name == 'pull_request'
52+
uses: actions/github-script@v7
53+
with:
54+
script: |
55+
const labels = context.payload.pull_request.labels.map(l => l.name);
56+
const allowLockfile = labels.includes('allow-lockfile-changes');
57+
console.log(`PR labels: ${labels.join(', ')}`);
58+
console.log(`Allow lockfile changes: ${allowLockfile}`);
59+
core.setOutput('allow', allowLockfile ? 'true' : 'false');
60+
61+
- name: 📥 Install dependencies (with lockfile validation)
62+
if: steps.check-label.outputs.allow != 'true'
5063
run: yarn install --immutable
5164

65+
- name: 📥 Install dependencies (allow lockfile changes)
66+
if: steps.check-label.outputs.allow == 'true'
67+
run: yarn install
68+
5269
- name: 🎨 Check formatting
5370
run: yarn format:check
5471

0 commit comments

Comments
 (0)