Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/triage-question-flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,28 @@ jobs:

const now = Date.now();
for (const issue of issues) {
const events = await github.rest.issues.listEventsForTimeline({
const { data: events } = await github.rest.issues.listEventsForTimeline({
...context.repo,
issue_number: issue.number,
per_page: 100
});
const humans = events.data

const humanComments = events
.filter(e => e.event === 'commented' && !e.actor.type.includes('Bot'))
.map(e => new Date(e.created_at).getTime());
const lastHuman = humans.length
? Math.max(...humans)
const lastHuman = humanComments.length
? Math.max(...humanComments)
: new Date(issue.created_at).getTime();
const ageDays = (now - lastHuman) / (24*3600*1000);

const labelEvents = events
.filter(e => e.event === 'labeled' && e.label && e.label.name === 'question')
.map(e => new Date(e.created_at).getTime());
const lastLabel = labelEvents.length
? Math.max(...labelEvents)
: 0;

const lastActivity = Math.max(lastHuman, lastLabel);
const ageDays = (now - lastActivity) / (24*3600*1000);

if (ageDays >= cfg.reminder_after_days) {
await github.rest.issues.removeLabel({
Expand Down
Loading