mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-19 18:25:58 +08:00
refactor: extract exclude-labels array to outer scope (#75)
This commit is contained in:
@@ -60,6 +60,7 @@ async function doQueryIssues(owner, repo, labels, state, creator) {
|
|||||||
let issues = [];
|
let issues = [];
|
||||||
let issueNumbers = [];
|
let issueNumbers = [];
|
||||||
if (res.length) {
|
if (res.length) {
|
||||||
|
const excludeLabelsArr = dealStringToArr(excludeLabels);
|
||||||
res.forEach(iss => {
|
res.forEach(iss => {
|
||||||
const a = bodyIncludes ? iss.body.includes(bodyIncludes) : true;
|
const a = bodyIncludes ? iss.body.includes(bodyIncludes) : true;
|
||||||
const b = titleIncludes ? iss.title.includes(titleIncludes) : true;
|
const b = titleIncludes ? iss.title.includes(titleIncludes) : true;
|
||||||
@@ -69,10 +70,9 @@ async function doQueryIssues(owner, repo, labels, state, creator) {
|
|||||||
* You can identify pull requests by the pull_request key.
|
* You can identify pull requests by the pull_request key.
|
||||||
*/
|
*/
|
||||||
if (a && b && iss.pull_request === undefined) {
|
if (a && b && iss.pull_request === undefined) {
|
||||||
if (excludeLabels) {
|
if (excludeLabelsArr.length) {
|
||||||
const labels = dealStringToArr(excludeLabels);
|
|
||||||
for (let i = 0; i < iss.labels.length; i += 1) {
|
for (let i = 0; i < iss.labels.length; i += 1) {
|
||||||
if (labels.includes(iss.labels[i].name)) return;
|
if (excludeLabelsArr.includes(iss.labels[i].name)) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user