From a87747095230e1b7f06169ce46d4d43970750322 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Thu, 23 Apr 2026 14:11:30 -0500 Subject: [PATCH] fix: auto-fix PR discovery via run-name embedding The GitHub API doesn't expose workflow_dispatch inputs on completed runs (inputs: null), so auto-fix-on-failure couldn't find the PR number when integration tests were dispatched on main. Fix: add run-name to integration and verify-build workflows that embeds 'PR #NNN' in the display title. auto-fix-on-failure parses this from github.event.workflow_run.display_title, falling back to branch-based PR lookup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/auto-fix-on-failure.yml | 9 +++++---- .github/workflows/polypilot-integration.yml | 1 + .github/workflows/verify-build.yml | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-fix-on-failure.yml b/.github/workflows/auto-fix-on-failure.yml index cea313d06..000cda74d 100644 --- a/.github/workflows/auto-fix-on-failure.yml +++ b/.github/workflows/auto-fix-on-failure.yml @@ -30,14 +30,15 @@ jobs: BRANCH="${{ github.event.workflow_run.head_branch }}" FAILED_WORKFLOW="${{ github.event.workflow_run.name }}" FAILED_RUN="${{ github.event.workflow_run.id }}" + DISPLAY_TITLE="${{ github.event.workflow_run.display_title }}" echo "Branch: $BRANCH" echo "Failed workflow: $FAILED_WORKFLOW" echo "Failed run: $FAILED_RUN" + echo "Display title: $DISPLAY_TITLE" - # workflow_dispatch runs execute on main but carry the PR number - # in their inputs. Try reading it from the API first. - PR_NUMBER=$(gh api "repos/${{ github.repository }}/actions/runs/$FAILED_RUN" \ - --jq '.inputs.pr_number // empty' 2>/dev/null || true) + # The dispatching workflow embeds "PR #NNN" in run-name. + # Parse it from the display title first. + PR_NUMBER=$(echo "$DISPLAY_TITLE" | grep -oP 'PR #\K[0-9]+' || true) # Fall back to branch-based lookup for push/PR-triggered runs if [ -z "$PR_NUMBER" ]; then diff --git a/.github/workflows/polypilot-integration.yml b/.github/workflows/polypilot-integration.yml index f52c6d478..ad2a4cf2f 100644 --- a/.github/workflows/polypilot-integration.yml +++ b/.github/workflows/polypilot-integration.yml @@ -1,4 +1,5 @@ name: "PolyPilot Integration Test" +run-name: "PolyPilot Integration Test${{ inputs.pr_number && format(' — PR #{0}', inputs.pr_number) || '' }}" on: workflow_dispatch: diff --git a/.github/workflows/verify-build.yml b/.github/workflows/verify-build.yml index 7f149894a..356b961a9 100644 --- a/.github/workflows/verify-build.yml +++ b/.github/workflows/verify-build.yml @@ -1,4 +1,5 @@ name: Verify Build (Cross-Platform) +run-name: "Verify Build${{ inputs.pr_number && format(' — PR #{0}', inputs.pr_number) || '' }}" on: workflow_dispatch: