Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create a Pull Request when it flags conflicts #3241

Closed
devjorgecastro opened this issue Aug 23, 2024 · 9 comments
Closed

Cannot create a Pull Request when it flags conflicts #3241

devjorgecastro opened this issue Aug 23, 2024 · 9 comments

Comments

@devjorgecastro
Copy link

devjorgecastro commented Aug 23, 2024

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

Result
image

@peter-evans
Copy link
Owner

Hi @devjorgecastro

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.

@devjorgecastro
Copy link
Author

@peter-evans Sorry, it was a transcription error in the issue description (updated description), I tested it with the changes you suggested here

@peter-evans
Copy link
Owner

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 }}

@devjorgecastro
Copy link
Author

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.

image

Change base to Master

image

@peter-evans
Copy link
Owner

Did you make this change, and are still seeing an issue?

@devjorgecastro
Copy link
Author

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.

@peter-evans
Copy link
Owner

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 }}

@peter-evans
Copy link
Owner

I'm almost certain this is not going to work unless you make two separate branches as suggested here.

@peter-evans
Copy link
Owner

Closing this for now. Feel free to continue the conversation if you need to.

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

No branches or pull requests

2 participants