diff --git a/__tests__/add-to-project.test.ts b/__tests__/add-to-project.test.ts index 8f0f8ed..a1d0205 100644 --- a/__tests__/add-to-project.test.ts +++ b/__tests__/add-to-project.test.ts @@ -223,6 +223,28 @@ describe('addToProject', () => { expect(gqlMock).not.toHaveBeenCalled() }) + test('does not add matching issues with labels filter with NOT label-operator', async () => { + mockGetInput({ + 'project-url': 'https://github.com/orgs/github/projects/1', + 'github-token': 'gh_token', + labeled: 'bug, new', + 'label-operator': 'NOT' + }) + + github.context.payload = { + issue: { + number: 1, + labels: [{name: 'bug'}] + } + } + + const infoSpy = jest.spyOn(core, 'info') + const gqlMock = mockGraphQL() + await addToProject() + expect(infoSpy).toHaveBeenCalledWith(`Skipping issue 1 because it contains one of the labels: bug, new`) + expect(gqlMock).not.toHaveBeenCalled() + }) + test('adds matching issues with multiple label filters', async () => { mockGetInput({ 'project-url': 'https://github.com/orgs/github/projects/1', diff --git a/action.yml b/action.yml index d172e93..8212771 100644 --- a/action.yml +++ b/action.yml @@ -15,7 +15,7 @@ inputs: description: A comma-separated list of labels to use as a filter for issue to be added label-operator: required: false - description: The behavior of the labels filter, AND to match all labels, OR to match any label (default is OR) + description: The behavior of the labels filter, AND to match all labels, OR to match any label, NOT to exclude any listed label (default is OR) runs: using: 'node16' main: 'dist/index.js'