Skip to content

[plan] Make Smoke Update Cross-Repo PR self-healing: auto-recreate pr-branch when missing #22233

Description

@github-actions

Context

From Safe Output Health Report - 2026-03-22.

The Smoke Update Cross-Repo PR workflow requires pr-branch to exist in githubnext/gh-aw-side-repo with an open PR targeting main. This branch was deleted (likely after a merged PR), causing every run to fail with fatal: couldn't find remote ref pr-branch.

Failing workflow run: §23392658504

Objective

Make the Smoke Update Cross-Repo PR workflow self-healing: if pr-branch doesn't exist, create it before the agent runs. This prevents manual intervention whenever the branch gets deleted.

Files to Modify

  • .github/workflows/smoke-update-cross-repo-pr.md — workflow configuration (98 lines)

Approach

Add a setup step to the workflow that ensures pr-branch exists in githubnext/gh-aw-side-repo:

Option A (Recommended) — Add a pre-agent shell step in the workflow frontmatter:

jobs:
  setup:
    steps:
      - name: Ensure pr-branch exists in side-repo
        run: |
          # Check if pr-branch exists
          if ! gh api repos/githubnext/gh-aw-side-repo/git/ref/heads/pr-branch --silent 2>/dev/null; then
            echo "pr-branch not found — creating from main"
            # Get current main SHA
            SHA=$(gh api repos/githubnext/gh-aw-side-repo/git/ref/heads/main --jq '.object.sha')
            gh api repos/githubnext/gh-aw-side-repo/git/refs \
              -f ref="refs/heads/pr-branch" \
              -f sha="$SHA"
            # Create an open PR if one doesn't exist
            gh pr create --repo githubnext/gh-aw-side-repo \
              --head pr-branch --base main \
              --title "smoke: pr-branch placeholder" \
              --body "Auto-created by Smoke Update Cross-Repo PR workflow for testing purposes."
          fi
        env:
          GH_TOKEN: ${{ secrets.GH_AW_SIDE_REPO_PAT }}

Option B — Update the existing agent prompt to add a conditional: if pr-branch doesn't exist, create it first before attempting the update.

Use Option A if the workflow supports pre-agent jobs. After editing the .md file, run make recompile.

Acceptance Criteria

  • The Smoke Update Cross-Repo PR workflow completes successfully even if pr-branch was previously deleted
  • pr-branch is auto-created (from main) when missing, with a corresponding open PR
  • The workflow does not fail with fatal: couldn't find remote ref pr-branch on any subsequent run
  • The recompiled .lock.yml is committed alongside the .md change

Notes

  • The secrets.GH_AW_SIDE_REPO_PAT token is already used in this workflow for cross-repo access — reuse it for the setup step
  • pr-branch must have an open PR for push_to_pull_request_branch to work (target: "1" references PR rejig docs #1 in the side-repo — verify this is still the correct PR number or update accordingly)

Generated by Plan Command for issue #discussion #22230 ·

  • expires on Mar 24, 2026, 4:46 AM UTC

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions