pull-request icon indicating copy to clipboard operation
pull-request copied to clipboard

source and destination branches are the same but not

Open havok2063 opened this issue 2 years ago • 4 comments

I'm trying to use this action to auto create a PR triggered off a branch name into master, basically the exact same example given in the docs. However, when the action runs, it says the Source and destination branches are the same. and does not create the PR. I'm trying to trigger from source branch dm_update_tree to destination branch master. My workflow looks like the following:

name: Add New Paths

on:
  push:
    branches:
      - dm_update_tree

jobs:
  createpr:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Create Pull Request
        id: open-pr
        uses: repo-sync/pull-request@v2
        with:
          source_branch: ""
          destination_branch: "master"
          pr_title: "New tree paths"
          pr_body: ":crown: *An automated PR*"
          pr_reviewer: "havok2063"
          pr_label: "auto-pr,enhancement"
          pr_draft: true
          github_token: ${{ secrets.GITHUB_TOKEN }}

      - name: Output PR URL
        run: echo ${{steps.open-pr.outputs.pr_url}}
      - name: Output PR Number
        run: echo ${{steps.open-pr.outputs.pr_number}}

havok2063 avatar Jun 06 '22 20:06 havok2063

I have the same problem with this test config.

on:
  push:
    branches: [ "feature-1" ]

jobs:
  pull-request:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: pull-request
      uses: repo-sync/pull-request@v2
      with:
        destination_branch: "dev"
        github_token: ${{ secrets.GITHUB_TOKEN }}

leonbusse avatar Jun 22 '22 16:06 leonbusse

I eventually figured it out. It works when there are committed differences between the source and destination branches. When there are no differences, you will get the message above and nothing will happen. In retrospect, I can see how Source and destination branches are the same refers to that, but there could be additional clarification added to the message. Originally I thought it was an indication that the action was not checking out the correct source branch.

havok2063 avatar Jun 22 '22 17:06 havok2063

When there are no differences, you will get the message above and nothing will happen.

I can confirm that this was the issue 👍🏻

leonbusse avatar Jun 22 '22 18:06 leonbusse

there is a parameter 'pr_allow_empty' that you can set to true, but it doesn't change anything... so I don't understand why this parameter exists, is this intended or a bug ?

tassin-gauthier avatar Oct 12 '22 10:10 tassin-gauthier

@tassin-gauthier by default pull-request avoids PRs with just a merge commit and no content, pr_allow_empty overrides this behavior and will create a PR with just a merge commit.

wei avatar Oct 31 '22 21:10 wei

#62 has an idea to improve this behavior.

wei avatar Oct 31 '22 21:10 wei