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

delete-branch: true doesn't delete the Branch #1520

Closed
mietzen opened this issue Jan 18, 2023 · 5 comments
Closed

delete-branch: true doesn't delete the Branch #1520

mietzen opened this issue Jan 18, 2023 · 5 comments

Comments

@mietzen
Copy link

mietzen commented Jan 18, 2023

Subject of the issue

delete-branch: true doesn't delete the branch after merge

Steps to reproduce

Set delete-branch: true and use auto merge to merge it:

      - name: Create Pull Request
        id: pr
        uses: peter-evans/create-pull-request@v4
        with:
          token: ${{ secrets.PUSH_TOKEN }}
          delete-branch: true
          title: '[Github Action Bot] Update'
          commit-message: Update
          committer: GitHub Action Bot <action@github.com>
          author: GitHub Action Bot <action@github.com>
          branch: auto-update
          branch-suffix: timestamp
          assignees: mietzen
          labels: |
            automated pr
            update

      - name: Automerge if possible
        if: steps.commit.outputs.change == 'yes' && steps.pr.outputs.pull-request-operation == 'created'
        uses: peter-evans/enable-pull-request-automerge@v2
        with:
          token: ${{ secrets.PUSH_TOKEN }}
          pull-request-number: ${{ steps.pr.outputs.pull-request-number }}
          merge-method: squash
@peter-evans
Copy link
Owner

Hi @mietzen

The delete-branch feature doesn't delete branches immediately on merge. (It can't do that because it would require the merge to somehow trigger the action.) The intention of the feature is that when the action next runs it will delete branches that don't have an active pull request associated with it.

If you want branches to be deleted immediately on merge then you should use GitHub's Automatically delete head branches feature in your repository settings.

@mietzen
Copy link
Author

mietzen commented Jan 19, 2023

Thanks for clarification!

@fharper
Copy link
Contributor

fharper commented Jul 21, 2023

I'm not sure how to phrase this shortly, but it would be worth updating its description at https://github.com/peter-evans/create-pull-request#action-inputs :)

@dezren39
Copy link
Contributor

Hi @mietzen

The delete-branch feature doesn't delete branches immediately on merge. (It can't do that because it would require the merge to somehow trigger the action.) The intention of the feature is that when the action next runs it will delete branches that don't have an active pull request associated with it.

If you want branches to be deleted immediately on merge then you should use GitHub's Automatically delete head branches feature in your repository settings.

this is an excellent description. i agree with @fharper that it should be in the readme/action-inputs. i had to search for this to figure out what it does.

@dezren39
Copy link
Contributor

#2631

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

4 participants