Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

ci: skip SDK shards when PR static checks fail (#2006)

Michael D'Angelofdfc57b57b97
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index 73ba786e3..2c161a817 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -162,9 +162,13 @@ jobs:
retention-days: 7
test:
- if: needs.classify-changes.outputs.source-required == 'true'
+ if: &run-sdk-shards >-
+ ${{ !cancelled() && needs.package.result == 'success' &&
+ needs['classify-changes'].outputs['source-required'] == 'true' &&
+ (github.event_name != 'pull_request' || github.event.action == 'edited' ||
+ needs['static-checks'].result == 'success') }}
name: tests / ${{ matrix.os }} / shard-${{ matrix.shard }}
- needs: [classify-changes, package]
+ needs: &sdk-shard-needs [classify-changes, package, static-checks]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
@@ -491,9 +495,9 @@ jobs:
run: node .github/scripts/verify-pr-source.mjs confirm-target
windows-test:
- if: needs.classify-changes.outputs.source-required == 'true'
+ if: *run-sdk-shards
name: windows-latest / node-22 / tests-${{ matrix.shard }}
- needs: [classify-changes, package]
+ needs: *sdk-shard-needs
runs-on: windows-latest
timeout-minutes: 40
strategy:
diff --git a/docs/ci.md b/docs/ci.md
index cffce852c..a11de33af 100644
--- a/docs/ci.md
+++ b/docs/ci.md
@@ -20,6 +20,11 @@ are discovered from the source tree, including new files without timing data.
Platform-specific filesystem, credential, process, cancellation, and resumed
worker cases remain enabled.
+SDK shards wait for static checks and a successful package build. A failing
+static check skips the shards when a PR opens, reopens, or receives new commits.
+Pushes to `main`, nightly and manual runs, and PR edits that need full
+qualification still run the shards.
+
The two Linux MCP jobs discover the same test files as local MCP testing. CI
assigns files by observed runtimes and starts the longest files first on each
job's two Node workers. Refresh the
diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.ts
index b05f52a12..1c83f7bac 100644
--- a/sdk/typescript/tests-ts/release-automation.test.ts
+++ b/sdk/typescript/tests-ts/release-automation.test.ts
@@ -3934,8 +3934,14 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}
"${{ needs.classify-changes.outputs.source-required == 'false' }}",
},
});
+ const sdkShards = ["test", "windows-test"];
for (const [name, job] of checks) {
- expect(job.if ?? "", name).not.toMatch(/\b(always|failure|cancelled)\(/u);
+ if (sdkShards.includes(name))
+ expect(job.needs).toContain("static-checks");
+ else
+ expect(job.if ?? "", name).not.toMatch(
+ /\b(always|failure|cancelled)\(/u,
+ );
}
// With no job results, the gate must report exactly the jobs enabled in YAML.
@@ -3963,6 +3969,7 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}
([name, job]) =>
name === "static-checks" ||
!job.if ||
+ (sdkShards.includes(name) && enabled === "source-required") ||
job.if === `needs.classify-changes.outputs.${enabled} == 'true'`,
);
expect(
diff --git a/sdk/typescript/tests-ts/workflow-quality.test.ts b/sdk/typescript/tests-ts/workflow-quality.test.ts
index 6820f7e2b..8e79c867a 100644
--- a/sdk/typescript/tests-ts/workflow-quality.test.ts
+++ b/sdk/typescript/tests-ts/workflow-quality.test.ts
@@ -94,6 +94,24 @@ test.each([
expect(interpolate(ci.concurrency["cancel-in-progress"], context)).toBe(
action === "push" ? "false" : "true",
);
+ const sdkGate = ci.jobs["test"]!.if!;
+ expect(ci.jobs["windows-test"]!.if).toBe(sdkGate);
+ const needs = {
+ "classify-changes": { outputs: { "source-required": "true" } },
+ package: { result: "success" },
+ "static-checks": { result: "failure" },
+ };
+ const run = (cancelled = false) =>
+ interpolate(sdkGate, { ...context, needs, cancelled: () => cancelled });
+ expect(run()).toBe(String(action === "push" || action === "edited"));
+ needs["static-checks"].result = "success";
+ expect(run()).toBe("true");
+ expect(run(true)).toBe("false");
+ needs.package.result = "failure";
+ expect(run()).toBe("false");
+ needs.package.result = "success";
+ needs["classify-changes"].outputs["source-required"] = "false";
+ expect(run()).toBe("false");
},
);