actions / labeler

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

any-glob-all-files: combine glob outputs to match all files on all globs #714

Closed jnewb1 closed 11 months ago

jnewb1 commented 11 months ago

checkout the discussion at https://github.com/actions/labeler/issues/423

there is currently no way to apply the "CI" label with the following rule

any-glob-all-files: [Jenkinsfile, .github/**]

when a PR which changes both Jenkinsfile and github actions files

essentially, this test fails, which to me makes "any glob matches all files" extremely confusing.

describe('check issue #423', () => {
  const changedFiles = ['test.md', 'test.puml'];

  describe('when at least one pattern matches all files', () => {
    const globPatterns = ['*.md', '*.puml'];

    it('returns true', () => {
      const result = checkIfAnyGlobMatchesAllFiles(
        changedFiles,
        globPatterns,
        false
      );
      expect(result).toBe(true);
    });
  });
});

perhaps this behavior should be moved to another rule, since it also breaks this potential use case: https://github.com/actions/labeler/blob/8558fd74291d67161a8a78ce36a881fa63b766a9/__tests__/changedFiles.test.ts#L228C3-L239C6

dfandrich commented 11 months ago

As mentioned in #423, I'd rather fix any-glob-to-all-files with these new semantics, since I'm pretty sure its current implementation is inadvertently implemented incorrectly. The old semantics are really one-glob-to-all-files but we don't need a special function to do that.

jnewb1 commented 11 months ago

this would be extremely helpful in our repo to get this merged!

jnewb1 commented 11 months ago

@MaksimZhukov

jnewb1 commented 11 months ago

who do I ask for a review to get this merged?