mirror of
https://github.com/actions/labeler.git
synced 2025-12-12 04:27:34 +00:00
22
dist/index.js
vendored
22
dist/index.js
vendored
@@ -76,11 +76,25 @@ function run() {
|
|||||||
labelsToRemove.push(label);
|
labelsToRemove.push(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (labels.length > 0) {
|
try {
|
||||||
yield addLabels(client, prNumber, labels);
|
if (labels.length > 0) {
|
||||||
|
yield addLabels(client, prNumber, labels);
|
||||||
|
}
|
||||||
|
if (syncLabels && labelsToRemove.length) {
|
||||||
|
yield removeLabels(client, prNumber, labelsToRemove);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (syncLabels && labelsToRemove.length) {
|
catch (error) {
|
||||||
yield removeLabels(client, prNumber, labelsToRemove);
|
if (error.name === 'HttpError' &&
|
||||||
|
error.message === 'Resource not accessible by integration') {
|
||||||
|
core.warning(`The action requires write permission to add labels to pull requests. For more information please refer to the action documentation: https://github.com/actions/labeler#permissions`, {
|
||||||
|
title: `${process.env['GITHUB_ACTION_REPOSITORY']} running under '${github.context.eventName}' is misconfigured`
|
||||||
|
});
|
||||||
|
core.setFailed(error.message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "labeler",
|
"name": "labeler",
|
||||||
"version": "4.0.1",
|
"version": "4.1.0",
|
||||||
"description": "Labels pull requests by files altered",
|
"description": "Labels pull requests by files altered",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -50,12 +50,29 @@ export async function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.length > 0) {
|
try {
|
||||||
await addLabels(client, prNumber, labels);
|
if (labels.length > 0) {
|
||||||
}
|
await addLabels(client, prNumber, labels);
|
||||||
|
}
|
||||||
|
|
||||||
if (syncLabels && labelsToRemove.length) {
|
if (syncLabels && labelsToRemove.length) {
|
||||||
await removeLabels(client, prNumber, labelsToRemove);
|
await removeLabels(client, prNumber, labelsToRemove);
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
if (
|
||||||
|
error.name === 'HttpError' &&
|
||||||
|
error.message === 'Resource not accessible by integration'
|
||||||
|
) {
|
||||||
|
core.warning(
|
||||||
|
`The action requires write permission to add labels to pull requests. For more information please refer to the action documentation: https://github.com/actions/labeler#permissions`,
|
||||||
|
{
|
||||||
|
title: `${process.env['GITHUB_ACTION_REPOSITORY']} running under '${github.context.eventName}' is misconfigured`
|
||||||
|
}
|
||||||
|
);
|
||||||
|
core.setFailed(error.message);
|
||||||
|
} else {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
core.error(error);
|
core.error(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user