mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-10 12:07:05 +00:00
Merge branch 'main' into graphql/projectv2
This commit is contained in:
10
dist/index.js
generated
vendored
10
dist/index.js
generated
vendored
@@ -53,13 +53,13 @@ function addToProject() {
|
||||
const labeled = (_a = core
|
||||
.getInput('labeled')
|
||||
.split(',')
|
||||
.map(l => l.trim())
|
||||
.map(l => l.trim().toLowerCase())
|
||||
.filter(l => l.length > 0)) !== null && _a !== void 0 ? _a : [];
|
||||
const labelOperator = core.getInput('label-operator').trim().toLocaleLowerCase();
|
||||
const octokit = github.getOctokit(ghToken);
|
||||
const urlMatch = projectUrl.match(urlParse);
|
||||
const issue = (_b = github.context.payload.issue) !== null && _b !== void 0 ? _b : github.context.payload.pull_request;
|
||||
const issueLabels = ((_c = issue === null || issue === void 0 ? void 0 : issue.labels) !== null && _c !== void 0 ? _c : []).map((l) => l.name);
|
||||
const issueLabels = ((_c = issue === null || issue === void 0 ? void 0 : issue.labels) !== null && _c !== void 0 ? _c : []).map((l) => l.name.toLowerCase());
|
||||
// Ensure the issue matches our `labeled` filter based on the label-operator.
|
||||
if (labelOperator === 'and') {
|
||||
if (!labeled.every(l => issueLabels.includes(l))) {
|
||||
@@ -67,6 +67,12 @@ function addToProject() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (labelOperator === 'not') {
|
||||
if (labeled.length > 0 && issueLabels.some(l => labeled.includes(l))) {
|
||||
core.info(`Skipping issue ${issue === null || issue === void 0 ? void 0 : issue.number} because it contains one of the labels: ${labeled.join(', ')}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (labeled.length > 0 && !issueLabels.some(l => labeled.includes(l))) {
|
||||
core.info(`Skipping issue ${issue === null || issue === void 0 ? void 0 : issue.number} because it does not have one of the labels: ${labeled.join(', ')}`);
|
||||
|
||||
Reference in New Issue
Block a user