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

It is not possible to create two continuous pull requests #3237

Closed
devjorgecastro opened this issue Aug 22, 2024 · 2 comments
Closed

It is not possible to create two continuous pull requests #3237

devjorgecastro opened this issue Aug 22, 2024 · 2 comments

Comments

@devjorgecastro
Copy link

devjorgecastro commented Aug 22, 2024

Subject of the issue

I want to create two Pull Requests to generate a Release: The first one points to develop and the second one points to master. When I only create one pull request it works fine but when I try to create the second one it is not created.

I leave here an example of how I am trying to do it:

Steps to reproduce

jobs:

  create-release-branch:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Create release branch
        run: git checkout -b release/1.1.0

      - name: Configure git
        run: |
          git config user.name 'Release Bot'
          git config user.email 'actions-user@users.noreply.github.com'

      - name: Create a test file
        run: |
          echo "1.1.0" > test_file.txt

      - name: Push new release branch
        run: git push origin release/1.1.0

      - name: Create Pull Request for develop
        uses: peter-evans/create-pull-request@v6
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: "Add test file for release version 1.1.0"
          base: develop
          branch: release/1.1.0
          title: 'Release 1.1.0'
          body: |
            Custom message
          author: 'Release Bot <actions-user@users.noreply.github.com>'
          labels: release


      - name: Create Pull Request for master
        uses: peter-evans/create-pull-request@v6
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: "Add test file for release version 1.1.0"
          base: master
          branch: release/1.1.0
          title: 'Release 1.1.0'
          body: |
            Custom message
          author: 'Release Bot <actions-user@users.noreply.github.com>'
          labels: release

Has anyone had the same problem? How could I solve it?

@peter-evans
Copy link
Owner

Hi @devjorgecastro

Firstly, you don't need any of these steps. This is because the action is designed to do that for you.

jobs:

  create-release-branch:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

-     - name: Create release branch
-       run: git checkout -b release/1.1.0

-     - name: Configure git
-       run: |
-         git config user.name 'Release Bot'
-         git config user.email 'actions-user@users.noreply.github.com'

      - name: Create a test file
        run: |
          echo "1.1.0" > test_file.txt

-     - name: Push new release branch
-       run: git push origin release/1.1.0

      - name: Create Pull Request for develop
        uses: peter-evans/create-pull-request@v6
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: "Add test file for release version 1.1.0"
          base: develop
          branch: release/1.1.0
          title: 'Release 1.1.0'
          body: |
            Custom message
          author: 'Release Bot <actions-user@users.noreply.github.com>'
          labels: release

As for creating a second PR, you have two options:

  1. Run the Create a test file step (or whatever generates the change) again before the action runs a second time.
  2. Use a matrix strategy in the workflow file to run the same steps for both develop and master.

@devjorgecastro
Copy link
Author

@peter-evans Thank you very much for the clarification. 🙂

This issue was closed.
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