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
`Could not fetch timeline for issue #${issueNumber}: ${err.message}`
57
105
);
106
+
continue;
58
107
}
59
108
60
-
if(!linkedPRFound){
61
-
constassigneeLogins=
62
-
issue.assignees.map(a=>a.login);
109
+
// Skip if no assignment timestamp
110
+
if(!assignedAt){
111
+
console.log(
112
+
`Issue #${issueNumber} has no assignment timestamp — skipping.`
113
+
);
114
+
continue;
115
+
}
63
116
64
-
awaitgithub.rest.issues.removeAssignees({
65
-
owner,
66
-
repo,
67
-
issue_number: issueNumber,
68
-
assignees: assigneeLogins,
69
-
});
117
+
constassignedDate=
118
+
newDate(assignedAt);
119
+
constnow=newDate();
70
120
71
-
constassigneesMention=
72
-
assigneeLogins.map(u=>`@${u}`).join(', ');
121
+
constdaysAssigned=
122
+
(now-assignedDate)/
123
+
(1000*60*60*24);
73
124
74
-
awaitgithub.rest.issues.createComment({
75
-
owner,
76
-
repo,
77
-
issue_number: issueNumber,
78
-
body: `Hey @ShantKhatri (Project Admin) and @Harxhit (Maintainer),
125
+
console.log(
126
+
`Issue #${issueNumber} assigned for ${daysAssigned.toFixed(
127
+
1
128
+
)} day(s).`
129
+
);
79
130
80
-
This issue (previously assigned to ${assigneesMention}) has been **automatically unassigned** because no linked pull request was found after the scheduled check.
131
+
// Skip if assigned <= 5 days
132
+
if(daysAssigned<=5){
133
+
console.log(
134
+
`Issue #${issueNumber} assigned less than 5 days ago — skipping.`
135
+
);
136
+
continue;
137
+
}
81
138
82
-
If work is in progress, please open a PR and link it to this issue to keep the assignment.`,
83
-
});
139
+
// Skip if linked PR exists
140
+
if(linkedPRFound){
141
+
console.log(
142
+
`Issue #${issueNumber} has linked open/draft PR — keeping assignment.`
143
+
);
144
+
continue;
84
145
}
146
+
147
+
// Remove assignees
148
+
awaitgithub.rest.issues.removeAssignees({
149
+
owner,
150
+
repo,
151
+
issue_number: issueNumber,
152
+
assignees: assigneeLogins,
153
+
});
154
+
155
+
constassigneesMention=
156
+
assigneeLogins
157
+
.map(user=>`@${user}`)
158
+
.join(', ');
159
+
160
+
// Comment
161
+
awaitgithub.rest.issues.createComment({
162
+
owner,
163
+
repo,
164
+
issue_number: issueNumber,
165
+
body: `Hey @ShantKhatri (Project Admin) and @Harxhit (Maintainer),
166
+
167
+
This issue (previously assigned to ${assigneesMention}) has been **automatically unassigned** because no linked pull request was found within 5 days of assignment.
168
+
169
+
If work is in progress, please open and link a PR to keep the assignment active.`,
0 commit comments