Cannot create a Pull Request when it flags conflicts
Closed this issue · 9 comments
Subject of the issue
I am trying to create a pull request but when marking conflicts it is not created. Is there a way to escape this validation and the PR is created with the conflicts so they can be resolved manually?
Steps to reproduce
jobs:
create-release-branch:
runs-on: ubuntu-latest
strategy:
matrix:
branch: [develop, master]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add changes
run: |
sed -i 's/^versionName=.*/versionName=${{ inputs.version-name }}/' version.properties
echo "2.0.10" > test_file.txt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Add test file for release version ${{ inputs.version-name }}"
base: ${{ matrix.branch }}
branch: release/${{ inputs.version-name }}
title: 'Release ${{ inputs.version-name }}'
body: |
Custom message
author: 'Release Bot <actions-user@users.noreply.github.com>'
labels: release
Please do what I suggested here and remove the unnecessary steps. I want to confirm that you aren't seeing this conflict because of those steps.
@peter-evans Sorry, it was a transcription error in the issue description (updated description), I tested it with the changes you suggested here
I'm not sure if this is the cause of the problem, but because you are creating two pull requests, the branches need to be unique.
-branch: release/${{ inputs.version-name }}
+branch: release/${{ matrix.branch }}/${{ inputs.version-name }}
I'm not sure if this is the cause of the problem, but because you are creating two pull requests, the branches need to be unique.
-branch: release/${{ inputs.version-name }} +branch: release/${{ matrix.branch }}/${{ inputs.version-name }}
The test works fine by adding a new file, but when I modify one that exists in Develop but not in Master, that is where the code conflict is generated and that is why the PR pointing to Master is not created.
If I go to the created Pull Request (the one pointing to Develop) and change the base of the Develop PR (the one that could be created) to point to Master, the conflicts can be seen.
Change base to Master
Did you make this change, and are still seeing an issue?
this change
@peter-evans Applying this change still causes the error to persist, and the requirement I have is to keep the same branch for the two pull requests, which, as I mentioned before, works well in the case where there are no files that conflict.
and the requirement I have is to keep the same branch for the two pull requests
I don't think that is going to work. I'm fairly sure that a branch can't be shared by multiple pull requests, but maybe I mis-remember.
I think the problem might be related to the base. You need a consistent base for each target. You should checkout the correct base for each.
- uses: actions/checkout@v4
with:
fetch-depth: 0
+ ref: ${{ matrix.branch }}
The remove this line from the action inputs. You don't need it because the action works out the base from the checked out branch.
- base: ${{ matrix.branch }}
I'm almost certain this is not going to work unless you make two separate branches as suggested here.
Closing this for now. Feel free to continue the conversation if you need to.