Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(visual-review): wire job check_run_id so CI re-trigger works (#59285)

Julian Bezbe5270387166
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.yml
index 596ba6d27979..c48b1f750b95 100644
--- a/.github/workflows/ci-e2e-playwright.yml
+++ b/.github/workflows/ci-e2e-playwright.yml
@@ -606,6 +606,8 @@ jobs:
# PRs are gating ("review"); master pushes are tracking-only ("observe") since
# there's no PR to approve and we don't want master runs to block or prompt for approval.
VR_PURPOSE: ${{ github.event_name == 'push' && 'observe' || 'review' }}
+ # Recorded on the run so the VR UI can re-trigger this job via the GitHub API.
+ JOB_CHECK_RUN_ID: ${{ job.check_run_id }}
run: |
RUN_ID=$(vr run create \
--type playwright \
diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.yml
index ae6bfcb90847..9d494d0122ee 100644
--- a/.github/workflows/ci-storybook.yml
+++ b/.github/workflows/ci-storybook.yml
@@ -206,6 +206,8 @@ jobs:
# PRs are gating ("review"); master pushes are tracking-only ("observe") since
# there's no PR to approve and we don't want master runs to block or prompt for approval.
VR_PURPOSE: ${{ github.event_name == 'push' && 'observe' || 'review' }}
+ # Recorded on the run so the VR UI can re-trigger this job via the GitHub API.
+ JOB_CHECK_RUN_ID: ${{ job.check_run_id }}
run: |
RUN_ID=$(vr run create \
--type storybook \
diff --git a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
index 0e501c5c81cb..8e6c7eb3cfe1 100644
--- a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
@@ -324,6 +324,13 @@ export function VisualReviewRunScene(): JSX.Element {
const hasMore = diffChanged + diffNew + diffRemoved > reviewPending + reviewApproved + reviewTolerated
+ // Re-trigger calls the GitHub API `/actions/jobs/{job_id}/rerun`; we only have that ID
+ // when the workflow wired `JOB_CHECK_RUN_ID=${{ job.check_run_id }}` into the CLI env.
+ // Older runs and runs from forks without that env var can't be re-triggered.
+ const ciRetriggerUnavailableReason = !run.metadata?.github_check_run_id
+ ? "This run wasn't recorded with a CI job ID, so it can't be re-triggered. Push a new commit to re-run CI."
+ : undefined
+
const handleApproveSnapshot = (): void => {
if (selectedSnapshot) {
approveSnapshot(selectedSnapshot)
@@ -363,7 +370,7 @@ export function VisualReviewRunScene(): JSX.Element {
</LemonBanner>
)}
- {allChangesResolved && (
+ {allChangesResolved && !ciRetriggerUnavailableReason && (
<LemonBanner
type="info"
className="mb-4"
@@ -533,7 +540,8 @@ export function VisualReviewRunScene(): JSX.Element {
run.status === 'completed' && !run.approved && !run.is_stale ? recomputeRun : undefined
}
recomputeDisabledReason={
- !allChangesResolved ? 'Re-trigger would not change the outcome' : undefined
+ ciRetriggerUnavailableReason ??
+ (!allChangesResolved ? 'Re-trigger would not change the outcome' : undefined)
}
/>
) : snapshotsLoading ? (