actions / labeler

An action for automatically labelling pull requests
MIT License
1.99k stars 419 forks source link

Having difficulty creating my globs #801

Open LimesKey opened 3 months ago

LimesKey commented 3 months ago

Sorry, not a bug report, I just couldn't find another place to post this.

I'm hoping to issue 3 labels to pull requests for my repo, one for 'Submission', 'Dev' and 'Invalid'. Having a little trouble understanding how to create globs, I've asked ChatGPT several times but I seem to be getting back code with syntax errors and nothing like what's in the README.

Submission

The Submission label should be applied if there are changes to the /projects directory but NOT if there are changes in other top-level directories and or in their subfolders, other than /projects of course.

Dev

This should almost be the reverse of 'Submission', which should apply when there are changes to any root directories and their subfolders but NOT when there are changes to the folder or any subfolders in the /projects directory.

Invalid

This should apply if there are changes in /projects AND in any other top-level directories (other than /projects) and their subdirectories.

Here's my current labeler.yml

Invalid:
- all:
  - changed-files:
    - any-glob-to-any-file: '*'
    - all-globs-to-any-file: 'projects/**'

# Add 'Submission' label to any changes within '/projects' folder or any subfolders
Submission:
- changed-files:
  - any-glob-to-any-file: 'projects/**'

Dev:
- all:
  - changed-files:
    - any-glob-to-any-file: '*'
    - all-globs-to-any-file: '!projects/**'

Currently, when there are changed files in the top level directory and in the /projects folder the Dev and Invalid label apply when the Invalid label should only be applied. The Dev and Invalid label should never be applied at the same time.

HarithaVattikuti commented 3 months ago

Hello @LimesKey Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

sameershelar-paypay commented 1 month ago

I m also facing this issue, Looks the the exclusion is not working as expected.

Label:
  - changed-files:
      - any-glob-to-any-file: libs/a1/**
      - any-glob-to-any-file: libs/a2/**
      - all-globs-to-all-files: '!libs/a1/**/*XX*'
      - all-globs-to-all-files: '!libs/a2/**/*XX*'

In this case the label should not be added if the changed file is present in libs/a1 or libs/a2 and the file name contains XX keyword.

But the label is being added for any change.

sebastian-nowak commented 1 month ago

@sameershelar-paypay, you're missing the top-level - all:. If you skip it, it defaults to - any:.

artpelling commented 1 week ago

I am having similar issues with the exclusion not working.

Here's my current labeler.yml

Shouldn't one use all-globs-to-ALL-files as suggested in the example section of the README.md?

artpelling commented 1 week ago

@HarithaVattikuti Is there any update on this? I've used the exclusion as demonstrated in the example section but it does not work.