Skip to content

fix: semantic-release backmerge fails with non-fast-forward when develop has diverged from main #202

@gandalf-at-lerian

Description

@gandalf-at-lerian

Affected Workflow

Release & Versioning (release, self-release, gptchangelog)

Workflow Version / Ref

@main

Bug Description

The @saithodev/semantic-release-backmerge plugin used in the release workflow fails when develop has commits that diverge from main. After a successful release (tag + publish), the backmerge step attempts git push HEAD:develop which is rejected as non-fast-forward.

This was triggered by a hotfix on main for plugin-auth — the .dockerignore was already fixed in develop (removing init/ from ignore list), but the hotfix patch on main created a divergent history that can't be fast-forwarded.

Steps to Reproduce

  1. Have develop branch ahead of main with different commits (e.g. a fix already applied independently)
  2. Merge a hotfix PR into main
  3. Release workflow triggers, semantic-release creates the tag successfully
  4. Backmerge step fails trying to push HEAD:develop

Caller workflow: standard release workflow from shared-workflows.
Trigger: merge to main (hotfix PR #480)

Expected Behavior

The backmerge step should handle non-fast-forward scenarios gracefully — either by performing a merge commit, rebasing, or at minimum not failing the entire release pipeline after the tag/release was already created successfully.

Relevant Logs / Error Output

Command failed with exit code 1: git push https://x-access-token:[secure]@github.com/LerianStudio/plugin-auth HEAD:develop

! [rejected]        HEAD -> develop (non-fast-forward)
error: failed to push some refs to 'https://github.com/LerianStudio/plugin-auth'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. If you want to integrate the remote changes,
hint: use 'git pull' before pushing again.

Failed run: https://github.com/LerianStudio/plugin-auth/actions/runs/24034388739/job/70090259275

Caller Workflow Configuration

# Standard shared release workflow invocation from plugin-auth
# Backmerge plugin: @saithodev/semantic-release-backmerge

Runner OS

Self-hosted

Checklist

  • I searched existing issues and this is not a duplicate.
  • I am using a supported version/ref of the workflow.
  • I have included relevant logs and configuration above.

Additional Context

Original card: #devops-team thread — Ferreira flagged the build failure on plugin-auth 2.5.0 release. Bedatty diagnosed the root cause as the .dockerignore excluding init/ directory on main (already fixed in develop). The hotfix PR was merged but the backmerge step broke due to branch divergence.

This is a systemic issue — any hotfix workflow where develop has independent commits will hit this.

Metadata

Metadata

Assignees

Labels

bugSomething is not working as expectedtriageNeeds initial assessment by the DevOps team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions