You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ data }=awaitgithub.rest.issues.listForRepo({
11
+
owner,
12
+
repo,
13
+
state: 'open',
14
+
per_page: 100,
15
+
page,
16
+
});
17
+
18
+
constonlyIssues=data.filter(i=>!i.pull_request);
19
+
issues=issues.concat(onlyIssues);
20
+
21
+
if(data.length<100)break;
22
+
page++;
23
+
}
24
+
25
+
console.log(`Found ${issues.length} open issue(s) to check.`);
26
+
27
+
for(constissueofissues){
28
+
constissueNumber=issue.number;
29
+
30
+
if(!issue.assignees||issue.assignees.length===0){
31
+
console.log(
32
+
`Issue #${issueNumber} has no assignees — skipping.`
33
+
);
34
+
continue;
35
+
}
36
+
37
+
letlinkedPRFound=false;
38
+
39
+
try{
40
+
consttimeline=
41
+
awaitgithub.rest.issues.listEventsForTimeline({
42
+
owner,
43
+
repo,
44
+
issue_number: issueNumber,
45
+
per_page: 100,
46
+
});
47
+
48
+
linkedPRFound=timeline.data.some(
49
+
event=>
50
+
event.event==='cross-referenced'&&
51
+
event.source?.issue?.pull_request&&
52
+
event.source?.issue?.state==='open'
53
+
);
54
+
}catch(err){
55
+
console.log(
56
+
`Could not fetch timeline for issue #${issueNumber}: ${err.message}`
57
+
);
58
+
}
59
+
60
+
if(!linkedPRFound){
61
+
constassigneeLogins=
62
+
issue.assignees.map(a=>a.login);
63
+
64
+
awaitgithub.rest.issues.removeAssignees({
65
+
owner,
66
+
repo,
67
+
issue_number: issueNumber,
68
+
assignees: assigneeLogins,
69
+
});
70
+
71
+
constassigneesMention=
72
+
assigneeLogins.map(u=>`@${u}`).join(', ');
73
+
74
+
awaitgithub.rest.issues.createComment({
75
+
owner,
76
+
repo,
77
+
issue_number: issueNumber,
78
+
body: `Hey @ShantKhatri (Project Admin) and @Harxhit (Maintainer),
79
+
80
+
This issue (previously assigned to ${assigneesMention}) has been **automatically unassigned** because no linked pull request was found after the scheduled check.
81
+
82
+
If work is in progress, please open a PR and link it to this issue to keep the assignment.`,
0 commit comments