Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tsu-ki authored Jan 2, 2025
1 parent b6c7a62 commit ca6b13d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,14 @@ const run = async () => {
issue_number: event.issue.number
});

const query = `type:pr state:open repo:${owner}/${repo} author:${event.issue.assignee.login} ${event.issue.number} in:body`;
const searchResult = await octokit.search.issuesAndPullRequests({
q: query
});

if (issueDetails.data.labels.length === 0) {
if (searchResult.data.total_count > 0) {
console.log(`Issue #${event.issue.number} has an open PR by ${event.issue.assignee.login}, skipping unassign.`);
} else if (issueDetails.data.labels.length === 0) {
console.log('unassigning ' + event.issue.assignee.login + " from " + event.issue.number);

await octokit.issues.removeAssignees({
Expand Down

0 comments on commit ca6b13d

Please sign in to comment.