Skip to content

Commit 76a8ba0

Browse files
fix(github): a namesake GitHub calls not required does not start a required check
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 279b82c commit 76a8ba0

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎packages/source-control-github/src/server/gitHubPullRequestJson.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,21 @@ describe("pull request detail decoding", () => {
554554
expect(detail.checksState).toBe("passing");
555555
});
556556

557+
it("waits for a required check that only a check GitHub calls not required shares a name with", () => {
558+
const detail = detailOf(
559+
[
560+
check({ name: "lint", status: "COMPLETED", conclusion: "SUCCESS", isRequired: true }),
561+
check({ name: "Done", status: "COMPLETED", conclusion: "SUCCESS", isRequired: false }),
562+
],
563+
{ baseRef: { compare: null, refUpdateRule: { requiredStatusCheckContexts: ["Done"] } } },
564+
);
565+
566+
expect(detail.checks.filter((entry) => entry.required)).toEqual([
567+
{ name: "lint", status: "success", description: null, url: null, required: true },
568+
{ name: "Done", status: "pending", description: null, url: null, required: true },
569+
]);
570+
});
571+
557572
it("adds no required check to a head no check has reported on", () => {
558573
const detail = detailOf([], {
559574
baseRef: { compare: null, refUpdateRule: { requiredStatusCheckContexts: ["Done"] } },

‎packages/source-control-github/src/server/gitHubPullRequestJson.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,8 +1210,13 @@ export function pullRequestChecksFromContexts(
12101210
const checks = toChecks(contexts);
12111211
const checksState = rollupChecksState(contexts);
12121212
if (contexts.length === 0) return { checks, checksState };
1213-
// Raw names, since deduping prefixes same-named jobs of different workflows with the workflow.
1214-
const started = new Set(contexts.map((c) => trimmed(c.name) ?? trimmed(c.context)));
1213+
// Raw names, since deduping prefixes same-named jobs of different workflows with the workflow. A
1214+
// context GitHub calls not required is another app's namesake of an app-bound requirement.
1215+
const started = new Set(
1216+
contexts.flatMap((c) =>
1217+
c.isRequired === false ? [] : [trimmed(c.name) ?? trimmed(c.context)],
1218+
),
1219+
);
12151220
const missing = requiredCheckNames.flatMap((name) =>
12161221
started.has(name)
12171222
? []

0 commit comments

Comments
 (0)