I am using a bitbucket pipeline for testing and would like to have the following work flow:
- A PR is merged into dev branch
- Tests run in the pipeline on the dev branch
- If the tests are successful, dev is automatically merged into main.
I am trying to merge dev into main using this step:
name: Merge with Main
image: atlassian/default-image:2
script:
- git fetch https://x-token-auth:$REPO_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git main
- git fetch origin dev
- git checkout dev
- git log
- git pull origin dev
- git fetch origin main:main
- git checkout main
- git log
- git merge dev
- git push https://x-token-auth:$REPO_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git main
However this gives the error:
+ git merge dev
<span><span>Auto-merging <a href="https://bitbucket.org/f50league/sgpsim_core/src/78df948399a55aa3df75ae588f14bb462511d7e8/bitbucket-pipelines.yml" rel="noopener noreferrer" target="_blank">bitbucket-pipelines.ym</a></span></span>
<span><span>CONFLICT (add/add): Merge conflict in <a href="https://bitbucket.org/f50league/sgpsim_core/src/78df948399a55aa3df75ae588f14bb462511d7e8/bitbucket-pipelines.yml" rel="noopener noreferrer" target="_blank">bitbucket-pipelines.yml</a></span></span>
4 Automatic merge failed; fix the conflicts and then commit the result.
When I run these steps locally I am able to merge to two branches:
Updating 03457968..78df9483
Fast-forward bitbucket-pipelines.yml
41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-)
What steps do I need to run to be able to successfully merge the two branches in the pipeline and why is there a discrepancy between running it locally and in the pipeline?
Many thanks