Skip to content

Commit c13d533

Browse files
authored
Merge pull request #583 from nextcloud/fix/ci/stale-action
fix(ci-action): consider label creation data in calculation
2 parents b5d8f9a + e5f8c5b commit c13d533

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

.github/workflows/triage-question-flow.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff 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({

0 commit comments

Comments
 (0)