Add "Rerun failed job ➔" link to error comment footer (#355)

* add "Rerun failed job" link to error comment footer

* Remove issueNumber guard from rerun link

The rerun action only needs run_id — the issue number in the trigger
URL path is just a route segment requirement. Use 0 as a fallback
so the link is always shown when a run ID is available.

* Overload `[number]` path segment as `runId` for the rerun action

For the rerun trigger, the `[number]` path param now carries the
workflow run ID instead of an issue number. The rerun link changes
from `/trigger/o/r/ISSUE?action=rerun&run_id=RID` to
`/trigger/o/r/RID?action=rerun`.

- Remove `run_id` query param from page.tsx and searchParams type
- Add error handling around `reRunWorkflow` for invalid run IDs
- Drop `issueNumber` from `BuildErrorCommentBodyParams` and all
  rerun link builders (errorReport, exitHandler, postCleanup)

* Reorder validation: action first, then rerun, then issueNumber

* address review: remove early toolState assignment, restructure rerun into dedicated block

* revert self-contained rerun block, share auth logic via issueOrRunId

* improve error handling

* normalize runid early

---------

Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
pullfrog[bot]
2026-02-27 12:32:06 +00:00
committed by pullfrog[bot]
parent c0fd69560f
commit 20b08b5321
9 changed files with 110 additions and 46 deletions
+16 -8
View File
@@ -141312,14 +141312,14 @@ async function buildCommentFooter({
customParts
}) {
const repoContext = parseRepoContext();
const runId = process.env.GITHUB_RUN_ID;
const runId = process.env.GITHUB_RUN_ID ? Number.parseInt(process.env.GITHUB_RUN_ID, 10) : void 0;
let jobId;
if (runId && octokit) {
try {
const { data: jobs } = await octokit.rest.actions.listJobsForWorkflowRun({
owner: repoContext.owner,
repo: repoContext.name,
run_id: parseInt(runId, 10)
run_id: runId
});
jobId = jobs.jobs[0]?.id.toString();
} catch {
@@ -143345,12 +143345,12 @@ function CreatePullRequestReviewTool(ctx) {
}
}
const footer = buildPullfrogFooter({
workflowRun: {
workflowRun: ctx.runId ? {
owner: ctx.repo.owner,
repo: ctx.repo.name,
runId: ctx.runId,
jobId: ctx.jobId
},
} : void 0,
customParts
});
const updatedBody = (body || "") + footer;
@@ -146893,10 +146893,18 @@ ${ctx.error}` : ctx.error;
}
const repoContext = parseRepoContext();
const octokit = createOctokit(getGitHubInstallationToken());
const runId = process.env.GITHUB_RUN_ID;
const runId = process.env.GITHUB_RUN_ID ? Number.parseInt(process.env.GITHUB_RUN_ID, 10) : void 0;
const customParts = [];
if (runId) {
const apiUrl = getApiUrl();
customParts.push(
`[Rerun failed job \u2794](${apiUrl}/trigger/${repoContext.owner}/${repoContext.name}/${runId}?action=rerun)`
);
}
const footer = buildPullfrogFooter({
triggeredBy: true,
workflowRun: runId ? { owner: repoContext.owner, repo: repoContext.name, runId } : void 0
workflowRun: runId ? { owner: repoContext.owner, repo: repoContext.name, runId } : void 0,
customParts
});
await octokit.rest.issues.updateComment({
owner: repoContext.owner,
@@ -147626,7 +147634,7 @@ function parseTimeString(input) {
// utils/workflow.ts
async function resolveRun(params) {
const runId = process.env.GITHUB_RUN_ID || "";
const runId = process.env.GITHUB_RUN_ID ? Number.parseInt(process.env.GITHUB_RUN_ID, 10) : void 0;
const githubRepo = process.env.GITHUB_REPOSITORY;
if (!githubRepo || !githubRepo.includes("/")) {
throw new Error(`GITHUB_REPOSITORY env var must be set to "owner/repo", got: ${githubRepo}`);
@@ -147638,7 +147646,7 @@ async function resolveRun(params) {
const jobs = await params.octokit.rest.actions.listJobsForWorkflowRun({
owner,
repo,
run_id: parseInt(runId, 10)
run_id: runId
});
const matchingJob = jobs.data.jobs.find((job) => job.name === jobName);
if (matchingJob) {