Skip to content

Commit adbe5b5

Browse files
committed
fix(ci): log PR inactivity dry-run diagnostics
1 parent 05e525d commit adbe5b5

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/pr-author-inactivity.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ jobs:
9898
9999
const now = Date.now();
100100
const summary = [];
101+
const diagnostics = [];
101102
102103
for (const pr of pulls) {
103104
const author = pr.user?.login;
104105
if (!author || pr.draft || isBot(author)) {
106+
if (DRY_RUN) {
107+
diagnostics.push(`#${pr.number}: skipped (${!author ? 'missing-author' : pr.draft ? 'draft' : 'bot-author'})`);
108+
}
105109
continue;
106110
}
107111
@@ -180,6 +184,11 @@ jobs:
180184
].filter((feedbackAt) => feedbackAt > latestAuthorResponseAt);
181185
182186
if (feedbackAts.length === 0) {
187+
if (DRY_RUN) {
188+
diagnostics.push(
189+
`#${pr.number}: skipped (no outstanding trusted feedback after author response; latestAuthorResponseAt=${latestAuthorResponseAt ? new Date(latestAuthorResponseAt).toISOString() : 'none'})`,
190+
);
191+
}
183192
continue;
184193
}
185194
@@ -191,13 +200,17 @@ jobs:
191200
192201
const inactiveFor = now - feedbackAt;
193202
const inactiveHours = Math.floor(inactiveFor / 3600000);
203+
const feedbackAtIso = new Date(feedbackAt).toISOString();
194204
195205
if (inactiveFor >= CLOSE_MS) {
196206
const line = DRY_RUN
197207
? `#${pr.number}: would close after ${inactiveHours}h of author inactivity`
198208
: `#${pr.number}: closed after ${inactiveHours}h of author inactivity`;
199209
200210
if (DRY_RUN) {
211+
diagnostics.push(
212+
`#${pr.number}: action=would-close latestAuthorResponseAt=${latestAuthorResponseAt ? new Date(latestAuthorResponseAt).toISOString() : 'none'} firstOutstandingFeedbackAt=${feedbackAtIso} reminderSent=${reminderSent}`,
213+
);
201214
summary.push(line);
202215
continue;
203216
}
@@ -230,6 +243,9 @@ jobs:
230243
: `#${pr.number}: reminded after ${inactiveHours}h of author inactivity`;
231244
232245
if (DRY_RUN) {
246+
diagnostics.push(
247+
`#${pr.number}: action=would-remind latestAuthorResponseAt=${latestAuthorResponseAt ? new Date(latestAuthorResponseAt).toISOString() : 'none'} firstOutstandingFeedbackAt=${feedbackAtIso} reminderSent=${reminderSent}`,
248+
);
233249
summary.push(line);
234250
continue;
235251
}
@@ -248,6 +264,19 @@ jobs:
248264
});
249265
250266
summary.push(line);
267+
continue;
268+
}
269+
270+
if (DRY_RUN) {
271+
diagnostics.push(
272+
`#${pr.number}: skipped (already-reminded-or-below-threshold) latestAuthorResponseAt=${latestAuthorResponseAt ? new Date(latestAuthorResponseAt).toISOString() : 'none'} firstOutstandingFeedbackAt=${feedbackAtIso} inactiveHours=${inactiveHours} reminderSent=${reminderSent}`,
273+
);
274+
}
275+
}
276+
277+
if (DRY_RUN) {
278+
for (const line of diagnostics) {
279+
core.info(line);
251280
}
252281
}
253282

0 commit comments

Comments
 (0)