Skip to content

Commit cd8590e

Browse files
joker23claude
andcommitted
fix(ci): scope dependency install to released packages only
Use yarn workspaces focus to install only dependencies of released packages (from .release-please-manifest.json). This excludes example apps and contract tests that bring in LGPL transitive deps like @img/sharp-libvips (via Next.js) which don't ship in published SDKs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6cd179d commit cd8590e

2 files changed

Lines changed: 24 additions & 35 deletions

File tree

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# Dependency Scan — License Compliance
2-
#
3-
# Generates a CycloneDX SBOM via cdxgen and evaluates it against an OPA/Rego
4-
# license policy. This checks for disallowed licenses (e.g. GPL in a
5-
# proprietary SDK) — it does NOT check for CVEs or security vulnerabilities.
6-
# Vulnerability scanning is handled separately by dependency-review-action.
7-
#
8-
# See: SDK-2170, SEC-7263
91

102
name: Dependency Scan
113

@@ -21,32 +13,25 @@ jobs:
2113
steps:
2214
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2315

24-
# The shared generate-sbom action runs cdxgen, which internally invokes
25-
# `yarn install` to resolve the dependency tree. This repo uses Yarn 3.x
26-
# via corepack (packageManager field in package.json), so corepack must
27-
# be enabled before cdxgen runs. Without this, cdxgen falls back to
28-
# system yarn (1.x), fails silently, and produces a 0-component BOM.
29-
- name: Setup Node with corepack
30-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
16+
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
3117
with:
3218
node-version: 20.x
3319

3420
- name: Enable corepack
3521
run: corepack enable
3622

37-
- name: Install dependencies (skip platform-specific optionals)
38-
run: |
39-
yarn config set supportedArchitectures.os --json '[]'
40-
yarn config set supportedArchitectures.cpu --json '[]'
41-
yarn config set supportedArchitectures.libc --json '[]'
42-
yarn install
23+
- name: Install released package dependencies
24+
run: yarn workspaces focus $(node scripts/released-packages.js)
4325
env:
4426
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'
27+
YARN_ENABLE_SCRIPTS: 'false'
28+
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
4529

4630
- name: Generate SBOM
47-
uses: launchdarkly/gh-actions/actions/dependency-scan/generate-sbom@8220ae5b6e56f7108d076da0e710dc4feca15101 # main
31+
uses: launchdarkly/gh-actions/actions/dependency-scan/generate-sbom@0a54234f88a428df4163234dbb23ddb7fee8b8ec # main
4832
with:
4933
types: 'nodejs'
34+
ensure-non-empty: 'true'
5035

5136
evaluate-policy:
5237
runs-on: ubuntu-latest
@@ -56,18 +41,6 @@ jobs:
5641
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5742

5843
- name: Evaluate SBOM Policy
59-
uses: launchdarkly/gh-actions/actions/dependency-scan/evaluate-policy@8220ae5b6e56f7108d076da0e710dc4feca15101 # main
44+
uses: launchdarkly/gh-actions/actions/dependency-scan/evaluate-policy@0a54234f88a428df4163234dbb23ddb7fee8b8ec # main
6045
with:
6146
artifacts-pattern: bom-*
62-
63-
# Guard against silent regression: if cdxgen fails to resolve
64-
# dependencies (e.g. corepack not enabled), the BOM will contain
65-
# 0 components and the policy evaluation vacuously passes.
66-
- name: Verify SBOM contains components
67-
run: |
68-
COMPONENT_COUNT=$(jq '.components | length' bom.json)
69-
echo "SBOM contains $COMPONENT_COUNT components"
70-
if [ "$COMPONENT_COUNT" -eq 0 ]; then
71-
echo "::error::SBOM contains 0 components — the scan produced nothing. Check that corepack is enabled and dependencies are installed."
72-
exit 1
73-
fi

scripts/released-packages.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Prints the workspace names of all released packages, one per line.
5+
* Released packages are those listed in .release-please-manifest.json.
6+
*/
7+
8+
const path = require('path');
9+
10+
const repoRoot = path.resolve(__dirname, '..');
11+
const manifest = require(path.join(repoRoot, '.release-please-manifest.json'));
12+
13+
for (const pkgPath of Object.keys(manifest)) {
14+
const { name } = require(path.join(repoRoot, pkgPath, 'package.json'));
15+
console.log(name);
16+
}

0 commit comments

Comments
 (0)