Skip to content

Commit

Permalink
Merge pull request #29 from OWASP-BLT/DonnieBLT-patch-2
Browse files Browse the repository at this point in the history
Update index.js
  • Loading branch information
DonnieBLT authored Jun 13, 2024
2 parents 8802e50 + cf76065 commit b0f3782
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const run = async () => {
}
}


if (issue && proceedWithIssueProcessing) {
console.log('processing issue');
const assigneeLogin = comment.user.login;
Expand Down Expand Up @@ -120,18 +119,27 @@ const run = async () => {
);

if ((Difference_In_Time / (1000 * 3600 * 24)) > 5) {
console.log('unassigning ' + event.issue.assignee.login + " from " + event.issue.number);

const assignees = event.issue.assignee.login.split(',').map((assigneeName) => assigneeName.trim());

var issue_number = event.issue.number;

octokit.issues.removeAssignees({
// Check if the issue has any labels
const issueDetails = await octokit.issues.get({
owner,
repo,
issue_number,
assignees,
})
issue_number: event.issue.number
});

if (issueDetails.data.labels.length === 0) {
console.log('unassigning ' + event.issue.assignee.login + " from " + event.issue.number);
const assignees = event.issue.assignee.login.split(',').map((assigneeName) => assigneeName.trim());
var issue_number = event.issue.number;

await octokit.issues.removeAssignees({
owner,
repo,
issue_number,
assignees,
});
} else {
console.log(`Issue #${event.issue.number} has labels, skipping unassign.`);
}
}
}
}
Expand Down

0 comments on commit b0f3782

Please sign in to comment.