Skip to content

ci: fix manifest-PR push rejection on workflow re-run - #4380

Closed
alxelax with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-call-manifest-pr-action
Closed

ci: fix manifest-PR push rejection on workflow re-run#4380
alxelax with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-call-manifest-pr-action

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown

The call-manifest-pr-action job fails when the workflow is re-run on a PR opened event because nrfconnect/action-manifest-pr@main attempts a non-force push of auto-manifest-sdk-zephyr-<PR> to nordicbuilder/sdk-nrf, which is rejected if the branch already exists from a prior run. The synchronize handler uses -f; the opened handler does not.

Changes

  • .github/workflows/manifest-PR.yml: Add a pre-step (gated on opened events) that deletes the existing remote branch via the GitHub API before the action runs. Uses || true so it is a no-op when the branch does not exist.
- name: Delete existing manifest branch if present
  if: github.event.action == 'opened'
  run: |
    PR_NUMBER="${{ github.event.pull_request.number }}"
    REPO_NAME="${{ github.event.repository.name }}"
    BRANCH="auto-manifest-${REPO_NAME}-${PR_NUMBER}"
    gh api --method DELETE "repos/nordicbuilder/sdk-nrf/git/refs/heads/${BRANCH}" 2>/dev/null || true
  env:
    GH_TOKEN: ${{ secrets.NCS_GITHUB_TOKEN }}

When PR #4379 triggered the 'opened' event, the external action
nrfconnect/action-manifest-pr@main tried to push a new branch
auto-manifest-sdk-zephyr-4379 to nordicbuilder/sdk-nrf. This
failed because the branch already existed from a previous run.

The 'opened' event handler in the action does not use --force,
unlike the 'synchronize' handler.

Fix: add a pre-step in the manifest-PR workflow that deletes the
existing remote branch (if any) via the GitHub API before the
action runs. The deletion is idempotent (errors are ignored).

Assisted-by: Claude:claude-sonnet-5

Co-authored-by: alxelax <47027043+alxelax@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job call-manifest-pr-action ci: fix manifest-PR push rejection on workflow re-run Aug 18, 2026
Copilot AI requested a review from alxelax August 18, 2026 07:21
Copilot stopped work on behalf of alxelax due to an error August 18, 2026 07:28
@alxelax alxelax closed this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants