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

Bug: Instead of removing the label from the PR, it deletes the label from the repo entirely #80

Closed
iansan5653 opened this issue May 21, 2020 · 7 comments

Comments

@iansan5653
Copy link

I have MERGE_REMOVE_LABELS set to configure the bot to remove the automerge label from the PR after merging it. This it does successfully, but not by removing the label from the PR. Instead, it deletes the label from the workspace entirely, so I have to create a new label every single time I want to auto merge a PR. Also, I can't have two automerged queued because the label will get deleted when the first is merged.

Here's my entire config:

name: automerge
on:
  pull_request:
    types:
      - labeled
      - unlabeled
      - synchronize
      - opened
      - edited
      - ready_for_review
      - reopened
      - unlocked
  pull_request_review:
    types:
      - submitted
  check_suite:
    types:
      - completed
  status: {}
jobs:
  automerge:
    runs-on: ubuntu-latest
    steps:
      - name: automerge
        uses: "pascalgn/automerge-action@80acb0f883348dcfd0e526288f7d27a12b9333be"
        env:
          GITHUB_TOKEN: "${{secrets.BOT_TOKEN}}"
          MERGE_REMOVE_LABELS: automerge
          MERGE_METHOD: squash
          MERGE_DELETE_BRANCH: true
@pascalgn
Copy link
Owner

Ah, yes, that's a bug, unfortunately, but there's no solution yet. See #56 for more information!

@r-plus
Copy link

r-plus commented Jun 3, 2020

Hi @pascalgn

I also see this issue.

I'm thinking using deleteLabel method on https://github.com/pascalgn/automerge-action/blob/master/lib/merge.js#L107 is the cause.

from octokit docment, https://octokit.github.io/rest.js/v17#issues-remove-label
We should use removeLabel method instead for it, isn't it?

@pascalgn
Copy link
Owner

pascalgn commented Jun 3, 2020

wow, that's embarrassing! 😄 Yes, of course, we should use removeLabel, not really sure why we implemented this with deleteLabel. If you want, you can create a PR for it, otherwise I will fix it today or tomorrow! 👍

@r-plus
Copy link

r-plus commented Jun 3, 2020

Thanks for your response, I can wait your fix 😆

@pascalgn
Copy link
Owner

pascalgn commented Jun 4, 2020

OK, this should be fixed now! Thanks a lot for the hint about the wrong method! 😄 👍

@r-plus
Copy link

r-plus commented Jun 4, 2020

Nice fix 👍

@pascalgn
Copy link
Owner

I think this is fixed now. However, feel free to reopen this or create a new issue if you disagree or if there are any other problems! 👍

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

3 participants