labeler icon indicating copy to clipboard operation
labeler copied to clipboard

How to only add label, not remove when PR is opened?

Open pllim opened this issue 5 years ago • 6 comments

I have a labeler action set up for when PR is opened, using all your default settings. The labeler YAML is set up as such (relevant parts listed below):

Docs:
  - docs/*

coordinates:
  - '**/coordinates/**/*'

When astropy/astropy#11023 was opened, the only file changed was docs/coordinates/apply_space_motion.rst. By the labeler logic, it should apply Docs and coordinates.

However, the PR author already manually applied Docs label at creation time. As a result, the labeler ended up removing the Docs label. Is this a bug? How do I tell it to simply no-op when a label that should be applied is already there?

Screenshot 2020-11-10 234620

Hope you can help and thanks for such a useful action!

pllim avatar Nov 11 '20 04:11 pllim

Strangely enough, accidental removal did not happen for astropy/astropy#11028 when the file changed was only docs/conf.py and Docs label was also applied manually when PR was opened.

Screenshot 2020-11-11 101002

Screenshot 2020-11-11 101107

(The Action ran successfully but it was a no-op, as expected.)

pllim avatar Nov 11 '20 15:11 pllim

There hasn't been much progress in the conversation, but I also want to solve this problem. By removing the manually attached tags, the benefits gained by labelar are diminished.

makecir avatar Feb 02 '21 02:02 makecir

Any news here?

ericdallo avatar Mar 16 '21 12:03 ericdallo

It looks like the problem is https://github.com/actions/labeler/blob/590628261a373c5bb0bbfbb751555f06766aace0/src/labeler.ts#L18 which is not correct because the default value is "false", and !!"false" == true.

adam-azarchs avatar Dec 23 '21 00:12 adam-azarchs

Confirmed, you can work around this bug by setting

sync-labels: ''

in your workflow.

adam-azarchs avatar Dec 23 '21 19:12 adam-azarchs

Confirmed, you can work around this bug by setting

sync-labels: ''

in your workflow.

Thanks for this, can also confirm this works in v4. Any plans to fix this properly in the next version?

liverpool1026 avatar May 24 '22 22:05 liverpool1026