Skip to content

Commit 4127453

Browse files
committed
fix: link review gate to workflow details
1 parent 7bc054b commit 4127453

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎.github/workflows/label-pr-review-state.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
const codeRabbitActiveLabel = 'coderabbit-review-active';
7777
const reviewGateName = 'Zoo Code / PR review gate';
7878
const reconciliationCheckName = 'Zoo Code / reconcile PR review state';
79+
const workflowRunUrl = `${context.serverUrl}/${owner}/${repo}/actions/runs/${context.runId}`;
7980
8081
// When triggered by a single PR event, only reconcile that PR.
8182
// The hourly schedule and workflow_dispatch reconcile all open PRs.
@@ -316,8 +317,7 @@ jobs:
316317
}
317318
if (!lookupSucceeded && passed) return;
318319
if (latestGateStatus?.state === state &&
319-
latestGateStatus.description === description &&
320-
latestGateStatus.target_url === pr.html_url) {
320+
latestGateStatus.description === description) {
321321
return;
322322
}
323323
const mustInvalidateSuccess = !passed &&
@@ -331,7 +331,7 @@ jobs:
331331
state,
332332
context: reviewGateName,
333333
description,
334-
target_url: pr.html_url,
334+
target_url: workflowRunUrl,
335335
});
336336
} catch (error) {
337337
if (required || mustInvalidateSuccess) throw error;

‎src/services/__tests__/pr-review-state-workflow.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const workflowScript = workflow.jobs.reconcile.steps[0].with.script as string
1515
const SHA = "a".repeat(40)
1616
const OLD_SHA = "b".repeat(40)
1717
const REVIEWED_AT = Date.parse("2026-08-29T15:02:00Z")
18+
const WORKFLOW_RUN_URL = "https://github.com/Zoo-Code-Org/Zoo-Code/actions/runs/123456"
1819

1920
type ReviewState = "APPROVED" | "CHANGES_REQUESTED" | "COMMENTED" | "DISMISSED"
2021

@@ -329,6 +330,8 @@ async function runWorkflow(options: HarnessOptions = {}) {
329330
const context = {
330331
eventName,
331332
repo: { owner: "Zoo-Code-Org", repo: "Zoo-Code" },
333+
runId: 123456,
334+
serverUrl: "https://github.com",
332335
payload,
333336
}
334337
const core = {
@@ -1099,7 +1102,12 @@ describe("PR review-state workflow", () => {
10991102
const result = await runWorkflow()
11001103

11011104
expect(latestGateStatus(result)).toEqual(
1102-
expect.objectContaining({ context: "Zoo Code / PR review gate", sha: SHA, state: "pending" }),
1105+
expect.objectContaining({
1106+
context: "Zoo Code / PR review gate",
1107+
sha: SHA,
1108+
state: "pending",
1109+
target_url: WORKFLOW_RUN_URL,
1110+
}),
11031111
)
11041112
})
11051113

0 commit comments

Comments
 (0)