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

Issue of the label configuration file ".github/labeler.yml" #101

Closed
BrightRan opened this issue Sep 23, 2020 · 13 comments
Closed

Issue of the label configuration file ".github/labeler.yml" #101

BrightRan opened this issue Sep 23, 2020 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@BrightRan
Copy link

BrightRan commented Sep 23, 2020

Associated GitHub Community ticket: https://github.mirror.nvdadr.community/t/labeler-typeerror-glob-pattern-string-required/133467

According to the README of this action, the following configurations in the label configuration file should work:

label-1:
  - any: ['list', 'of', 'globs']
    all: ['list', 'of', 'globs']

label-2:
  - example1/*
  - example2/**/*

I tested with two label configuration files in my repository (see here).

  • .github/labeler-01.yml
    common:
      - any: ['./*', './src/**']
    
    workflow:
      - any: ['.github/workflows/**']
  • .github/labeler-02.yml
    repo:
      - './*'
      - './src/**'
    
    GHA:
      - '.github/**'

And my workflow looks like this (see here):

name: CI

on: pull_request

jobs:
  job1:
    runs-on: ubuntu-latest
    steps:         
      - name: PR Labeler
        uses: actions/labeler@2.2.0
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          configuration-path: .github/labeler-01.yml

  job2:
    runs-on: ubuntu-latest
    steps:         
      - name: PR Labeler
        uses: actions/labeler@2.2.0
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          configuration-path: .github/labeler-02.yml

I changed the following files:

  • ./.github/workflows/ci.yml
  • ./test.txt
  • ./src/test.txt

However, finally only the GHA label was added successfully, the other three should also be added but not (see the example PR).

When using '.github/labeler-01.yml', the actions always fails with the error (see job1):

##[error]TypeError: glob pattern string required
##[error]glob pattern string required

When using '.github/labeler-02.yml', the action displays as success, but only the GHA label is added (see job2).

@hauleth
Copy link

hauleth commented Sep 25, 2020

I also spotted this. It happens if I have more than one entry in the any specifier.

@hauleth
Copy link

hauleth commented Sep 27, 2020

Ok, I have found what is the culprit there. The meaning of any and all is poorly defined. The issue there is that

- any: ['./*', './src/*']

and

- ./*
- ./src/*

Have different meaning. The list in any mean that any file in the PR must match all globs in the list. With all it mean that all files in the PR must match all globs in the list. So to have the same behaviour with any you need to use:

- any: ['./*']
- any: ['./src/*']

@mittalyashu
Copy link

Have different meaning. The list in any mean that any file in the PR must match all globs in the list. With all it mean that all files in the PR must match all globs in the list. So to have the same behaviour with any you need to use.

Nope. Still don't get it 😅

@hauleth
Copy link

hauleth commented Sep 28, 2020

@mittalyashu assume that you have such definition any: ['src/*', '*/test/*']. Then it will apply the tag if any of the files matches all globs. So for example if your PR changes files:

  • examples/foo
  • src/test/foo

Then it will apply, as src/test/foo matches both of the globs. However if list of files would look like:

  • examples/test/foo

Then it will not match, because while */test/* matches, the src/* doesn't, so whole filter fails.

You can think of it like (using Ruby syntax):

  • any - changed_files.any? { |file| matches.all? { |match| file.matches(match) } }
  • all - changed_files.all? { |file| matches.all? { |match| file.matches(match) } }

@mittalyashu
Copy link

Oh! I see.

Well, seems like the docs were not clear.

I was thinking that in the any filter, it will match any globs listed in the array.


In that case, doesn't that means any and all both plays the same role?

@hauleth
Copy link

hauleth commented Sep 29, 2020

Not quite. all will check if all modified paths matches while any will check if any modified patch matches.

@BrightRan
Copy link
Author

Another user has the similar problem:
https://github.mirror.nvdadr.community/t/labler-action-error-typeerror-glob-pattern-string-required-glob-pattern-string-required/140738

He gets the same error message:

##[error]TypeError: glob pattern string required
##[error]glob pattern string required

@BrightRan
Copy link
Author

Hi team,

Could anyone take a look at this issue?

@kbendick
Copy link

kbendick commented Nov 4, 2020

I'm also running into this issue. I'm unable to use any configuration that has any in it on 2.2.0.

smokhov added a commit to OpenISS/OpenISS that referenced this issue Jan 14, 2022
@MaksimZhukov MaksimZhukov added the bug Something isn't working label Dec 12, 2022
terjekv added a commit to hubuum/hubuum that referenced this issue Apr 15, 2023
@MaksimZhukov
Copy link
Contributor

Hello everyone!
We have released a new major version of the action. The behaviour of the any selector was changed to match ANY file against ANY glob pattern so it became more intuitive. Please find more details in the release notes.

Could you please use the new version and provide us with your feedback?

@MaksimZhukov MaksimZhukov self-assigned this Jul 11, 2023
@MaksimZhukov
Copy link
Contributor

Hello everyone!
We've released a new beta version of the action. The configuration file structure was changed to provide more flexibility and readability. For more information, see the release notes.

If you have any questions, ideas or concerns, please share them in this issue.

@MaksimZhukov
Copy link
Contributor

Hello everyone!
We have released the new major version of the action, which contains a new, more intuitive and flexible configuration file structure. Please read the action documentation to find out how to adapt your configuration files and workflows for use with the new action version.

Thank you all for your patience!
Do not hesitate to contact us if you have any questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants