Open mehdihadeli opened 1 year ago
I am having the same problem with the following config:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
["@semantic-release/git", {
"assets": ["CHANGELOG.md"]
}],
["@semantic-release/gitlab", {
"assets": [
{"path": "gitlab-assets/*.pdf", "type": "other"}
]
}],
["@semantic-release/exec", {
"verifyReleaseCmd": "echo ${nextRelease.version} > VERSION && bash bintools/bump-version ${nextRelease.version}"
}],
["@saithodev/semantic-release-backmerge", {
"backmergeBranches": [
{"from": "production", "to": "main"},
{"from": "pre-production", "to": "main"}],
"mergeMode": "ours"
}]
],
"branches": [
{"name": "main", "prerelease": "dev"},
{"name": "pre-production", "prerelease": "rc"},
{"name": "production", "prerelease": false}
]
}
Releases on any of the triggering branches pre-production
or production
lead to failing back-merge attempts:
[4:28:19 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ✘ Process aborted due to an error while backmerging a branch.
[4:28:19 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ✘ Error: Command failed with exit code 1: git push [https://gitlab-ci-token:[secure]@REPO_URL.git](https://gitlab-ci-token:%5Bsecure%5D@REPO_URL.git) HEAD:main
To https://REPO_URL.git
! [rejected] HEAD -> main (non-fast-forward)
error: failed to push some refs to 'https://REPO_URL.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
at makeError (/builds/REPO/node_modules/execa/lib/error.js:60:11)
at handlePromise (/build/REPO/node_modules/execa/index.js:118:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///builds/REPO/node_modules/@saithodev/semantic-release-backmerge/dist/helpers/git.js:16:32
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1
Hi @saitho, First thanks for this useful plugin :) I get below error when I push to my main branch and
backmerge
, merge this branch to my dev branch. My dev branch has some changes that not exists in main branch and I usedXours
for merging in dev branch and prioritizing dev changes in auto merge. This is my config:Error:
I think the problem is using
git checkout -B dev
instead ofgit checkout dev
in your code, and in your code-B
doesn't pull the remote branch in the local (creates new branch), and we get error here because check branch doesn't have changes in the remote.I tested following commands in my local and it works:
but when I use these commands like your approach and using
-B
flag, I get mentioned error:Error in my local:
Here (with using
git checkout -B dev
) we need an extragit pull origin dev -Xours
command after checkout and before push, to this works for me.I think, this #36 issue has same problem