Compare commits

..
Author SHA1 Message Date
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
b8dd2d9be0 Bump @typescript-eslint/eslint-plugin from 8.59.1 to 8.61.1 (#942)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.59.1 to 8.61.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.61.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-version: 8.61.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-06 11:58:15 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>chiranjib-swain
53affe8ca4 Bump js-yaml to 4.2.0, apply npm audit fix, and add undici override for 0 vulnerabilities (#943)
* Bump js-yaml from 4.1.1 to 4.2.0

Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.1 to 4.2.0.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/commits)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump js-yaml to version 4.2.0

* chore: update package.json and package-lock.json with undici override and bump js-yaml to 4.2.0

* chore: remove obsolete license files for busboy and undici, add undici license file

* chore: update version to 6.2.0 in package.json and regenerate package-lock.json

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chiranjib-swain <chiranjib-swain@github.com>
2026-07-06 11:54:28 -05:00
Chiranjib SwainandGitHub f612d9ad18 Fix: Improve PR number validation and warning messages in input handling (#939)
* Fix: Improve PR number validation and warning messages in input handling

* Fix: Enhance PR number validation with improved sanitization and warning messages

* Fix: Change sanitizeForWarning to a local function for better encapsulation
2026-06-22 16:16:37 -05:00
CopilotGitHubchiranjib-swaincopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
f27b608878 chore: upgrade dependencies (@actions/core, @actions/github, js-yaml, minimatch, @typescript-eslint) (#934)
* chore: upgrade dependencies and update license cache

Agent-Logs-Url: https://github.com/actions/labeler/sessions/b9db86f9-e9cd-4c8a-a1a1-84e33ef84437

Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>

* fix: remove unused error variable in catch block to fix lint

Agent-Logs-Url: https://github.com/actions/labeler/sessions/7a6c6978-c912-4278-be03-f22f98e28f71

Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>

* build: update dist/index.js with latest source changes

Agent-Logs-Url: https://github.com/actions/labeler/sessions/a5e02d2e-473f-4106-9227-2b5b25b15b81

Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>

* chore: bump version to 6.1.0, update lockfile, and rebuild dist/index.js

Agent-Logs-Url: https://github.com/actions/labeler/sessions/08c6ea0c-fa19-47d8-a4fd-bbdaf444071f

Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>
2026-05-05 21:37:09 -05:00
17 changed files with 19297 additions and 13970 deletions
+1
View File
@@ -12,6 +12,7 @@ allowed:
reviewed:
npm:
- "@actions/http-client"
- balanced-match
- brace-expansion
- minimatch
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/core"
version: 1.11.1
version: 2.0.3
type: npm
summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core
+2 -2
View File
@@ -1,6 +1,6 @@
---
name: "@actions/exec"
version: 1.1.1
version: 2.0.0
type: npm
summary: Actions exec lib
homepage: https://github.com/actions/toolkit/tree/main/packages/exec
@@ -17,4 +17,4 @@ licenses:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []
notices: []
@@ -4,7 +4,7 @@ version: 2.2.3
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
license: mit
license: other
licenses:
- sources: LICENSE
text: |
+32
View File
@@ -0,0 +1,32 @@
---
name: "@actions/http-client"
version: 3.0.2
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
license: other
licenses:
- sources: LICENSE
text: |
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []
+2 -2
View File
@@ -1,6 +1,6 @@
---
name: "@actions/io"
version: 1.1.3
version: 2.0.0
type: npm
summary: Actions io lib
homepage: https://github.com/actions/toolkit/tree/main/packages/io
@@ -17,4 +17,4 @@ licenses:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []
notices: []
-30
View File
@@ -1,30 +0,0 @@
---
name: "@fastify/busboy"
version: 2.0.0
type: npm
summary: A streaming parser for HTML form data for node.js
homepage:
license: mit
licenses:
- sources: LICENSE
text: |-
Copyright Brian White. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
notices: []
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: brace-expansion
version: 5.0.4
version: 5.0.7
type: npm
summary: Brace expansion as known from sh/bash
homepage:
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: js-yaml
version: 4.1.1
version: 4.2.0
type: npm
summary: YAML 1.2 parser and serializer
homepage:
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: minimatch
version: 10.2.3
version: 10.2.5
type: npm
summary: a glob matcher in javascript
homepage:
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: undici
version: 5.29.0
version: 6.27.0
type: npm
summary: An HTTP/1.1 client, written from scratch for Node.js
homepage: https://undici.nodejs.org
+191
View File
@@ -441,6 +441,197 @@ describe('run', () => {
);
});
it('(with pr-number: non-numeric string) warns and makes no API call', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['abc']
});
usingLabelerConfigYaml('only_pdfs.yml');
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'abc' is not a valid pull request number"
);
expect(getPullMock).not.toHaveBeenCalled();
expect(setLabelsMock).not.toHaveBeenCalled();
});
it('(with pr-number: negative number) warns and makes no API call', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['-1']
});
usingLabelerConfigYaml('only_pdfs.yml');
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'-1' is not a valid pull request number"
);
expect(getPullMock).not.toHaveBeenCalled();
expect(setLabelsMock).not.toHaveBeenCalled();
});
it('(with pr-number: zero) warns and makes no API call', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['0']
});
usingLabelerConfigYaml('only_pdfs.yml');
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'0' is not a valid pull request number"
);
expect(getPullMock).not.toHaveBeenCalled();
expect(setLabelsMock).not.toHaveBeenCalled();
});
it('(with pr-number: number with internal space) warns and makes no API call', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['10 4']
});
usingLabelerConfigYaml('only_pdfs.yml');
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'10 4' is not a valid pull request number"
);
expect(getPullMock).not.toHaveBeenCalled();
expect(setLabelsMock).not.toHaveBeenCalled();
});
it('(with pr-number: number with trailing non-numeric chars) warns and makes no API call', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['104abc']
});
usingLabelerConfigYaml('only_pdfs.yml');
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'104abc' is not a valid pull request number"
);
expect(getPullMock).not.toHaveBeenCalled();
expect(setLabelsMock).not.toHaveBeenCalled();
});
it('(with pr-number: valid number with surrounding whitespace) trims and processes correctly', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': [' 104 ']
});
usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles('foo.pdf');
getPullMock.mockResolvedValue(<any>{data: {labels: []}});
await run();
expect(getPullMock).toHaveBeenCalled();
expect(coreWarningMock).not.toHaveBeenCalledWith(
expect.stringContaining('is not a valid pull request number')
);
});
it('(with pr-number: string with carriage return) sanitizes CR as \\x0d in warning', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['abc\rdef']
});
usingLabelerConfigYaml('only_pdfs.yml');
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'abc\\x0ddef' is not a valid pull request number (non-printable characters were escaped as \\xNN)"
);
expect(getPullMock).not.toHaveBeenCalled();
expect(setLabelsMock).not.toHaveBeenCalled();
});
it('(with pr-number: string with tab) sanitizes tab as \\x09 in warning', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['abc\tdef']
});
usingLabelerConfigYaml('only_pdfs.yml');
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'abc\\x09def' is not a valid pull request number (non-printable characters were escaped as \\xNN)"
);
expect(getPullMock).not.toHaveBeenCalled();
expect(setLabelsMock).not.toHaveBeenCalled();
});
it('(with pr-number: string with ANSI escape sequence) sanitizes ESC byte as \\x1b in warning', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['abc\x1b[31mINJECTED\x1b[0m']
});
usingLabelerConfigYaml('only_pdfs.yml');
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'abc\\x1b[31mINJECTED\\x1b[0m' is not a valid pull request number (non-printable characters were escaped as \\xNN)"
);
expect(getPullMock).not.toHaveBeenCalled();
expect(setLabelsMock).not.toHaveBeenCalled();
});
it('(with pr-number: mix of valid and invalid) processes valid, skips invalid with warning', async () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'pr-number': ['104', 'abc']
});
usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles('foo.pdf');
getPullMock.mockResolvedValue(<any>{
data: {labels: []}
});
await run();
expect(coreWarningMock).toHaveBeenCalledWith(
"'abc' is not a valid pull request number"
);
expect(setLabelsMock).toHaveBeenCalledTimes(1);
expect(setLabelsMock).toHaveBeenCalledWith({
owner: 'monalisa',
repo: 'helloworld',
issue_number: 104,
labels: ['touched-a-pdf-file']
});
});
it('does not add labels to PRs that have no changed files', async () => {
usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles();
+18529 -13392
View File
File diff suppressed because one or more lines are too long
+506 -525
View File
File diff suppressed because it is too large Load Diff
+11 -9
View File
@@ -1,9 +1,9 @@
{
"name": "labeler",
"version": "6.0.0",
"version": "6.2.0",
"description": "Labels pull requests by files altered",
"main": "lib/main.js",
"engines": {
"engines": {
"node": ">=24"
},
"scripts": {
@@ -27,12 +27,15 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.0",
"@actions/core": "^2.0.3",
"@actions/github": "^6.0.1",
"@octokit/plugin-retry": "^6.0.0",
"js-yaml": "^4.1.0",
"js-yaml": "^4.2.0",
"lodash.isequal": "^4.5.0",
"minimatch": "^10.2.3"
"minimatch": "^10.2.5"
},
"overrides": {
"undici": "6.27.0"
},
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40,8 +43,8 @@
"@types/lodash.isequal": "^4.5.8",
"@types/minimatch": "^5.1.2",
"@types/node": "^24.1.0",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.61.1",
"@typescript-eslint/parser": "^8.59.0",
"@vercel/ncc": "^0.38.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
@@ -51,6 +54,5 @@
"prettier": "^3.4.2",
"ts-jest": "^29.2.5",
"typescript": "^5.7.3"
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ export async function* getPullRequests(
pull_number: prNumber
});
prData = result.data;
} catch (error: any) {
} catch {
core.warning(`Could not find pull request #${prNumber}, skipping`);
continue;
}
+16 -3
View File
@@ -4,6 +4,13 @@ import * as github from '@actions/github';
const getPrNumberFromContext = () =>
github.context.payload.pull_request?.number;
const sanitizeForWarning = (value: string): string => {
return value.replace(
/[\x00-\x1F\x7F-\x9F]/g,
c => `\\x${c.charCodeAt(0).toString(16).padStart(2, '0')}`
);
};
export const getPrNumbers = (): number[] => {
const prInput = core.getMultilineInput('pr-number');
@@ -14,10 +21,16 @@ export const getPrNumbers = (): number[] => {
const result: number[] = [];
for (const line of prInput) {
const prNumber = parseInt(line, 10);
const trimmed = line.trim();
const prNumber = parseInt(trimmed, 10);
if (isNaN(prNumber) && prNumber <= 0) {
core.warning(`'${prNumber}' is not a valid pull request number`);
if (isNaN(prNumber) || prNumber <= 0 || String(prNumber) !== trimmed) {
const sanitized = sanitizeForWarning(line);
const hint =
sanitized !== line
? ' (non-printable characters were escaped as \\xNN)'
: '';
core.warning(`'${sanitized}' is not a valid pull request number${hint}`);
continue;
}