File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,18 +37,28 @@ jobs:
3737
3838 const now = Date.now();
3939 for (const issue of issues) {
40- const events = await github.rest.issues.listEventsForTimeline({
40+ const { data: events } = await github.rest.issues.listEventsForTimeline({
4141 ...context.repo,
4242 issue_number: issue.number,
4343 per_page: 100
4444 });
45- const humans = events.data
45+
46+ const humanComments = events
4647 .filter(e => e.event === 'commented' && !e.actor.type.includes('Bot'))
4748 .map(e => new Date(e.created_at).getTime());
48- const lastHuman = humans .length
49- ? Math.max(...humans )
49+ const lastHuman = humanComments .length
50+ ? Math.max(...humanComments )
5051 : new Date(issue.created_at).getTime();
51- const ageDays = (now - lastHuman) / (24*3600*1000);
52+
53+ const labelEvents = events
54+ .filter(e => e.event === 'labeled' && e.label && e.label.name === 'question')
55+ .map(e => new Date(e.created_at).getTime());
56+ const lastLabel = labelEvents.length
57+ ? Math.max(...labelEvents)
58+ : 0;
59+
60+ const lastActivity = Math.max(lastHuman, lastLabel);
61+ const ageDays = (now - lastActivity) / (24*3600*1000);
5262
5363 if (ageDays >= cfg.reminder_after_days) {
5464 await github.rest.issues.removeLabel({
You can’t perform that action at this time.
0 commit comments