Skip to content

Commit d73db95

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 56a4bbb commit d73db95

2 files changed

Lines changed: 22 additions & 34 deletions

File tree

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +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
9-
101
name: Dependency Scan
112

123
on:
@@ -21,32 +12,25 @@ jobs:
2112
steps:
2213
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2314

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
15+
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
3116
with:
3217
node-version: 20.x
3318

3419
- name: Enable corepack
3520
run: corepack enable
3621

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
22+
- name: Install released package dependencies
23+
run: yarn workspaces focus $(node scripts/released-packages.js)
4324
env:
4425
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'
26+
YARN_ENABLE_SCRIPTS: 'false'
27+
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
4528

4629
- name: Generate SBOM
4730
uses: launchdarkly/gh-actions/actions/dependency-scan/generate-sbom@0a54234f88a428df4163234dbb23ddb7fee8b8ec # main
4831
with:
4932
types: 'nodejs'
33+
ensure-non-empty: 'true'
5034

5135
evaluate-policy:
5236
runs-on: ubuntu-latest
@@ -59,15 +43,3 @@ jobs:
5943
uses: launchdarkly/gh-actions/actions/dependency-scan/evaluate-policy@0a54234f88a428df4163234dbb23ddb7fee8b8ec # main
6044
with:
6145
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)