generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 17
58 lines (47 loc) · 1.88 KB
/
issue-update-reminder.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Issue Update Reminder
on:
schedule:
- cron: '0 0 * * *' # Run daily at midnight
jobs:
issue-update-reminder:
runs-on: ubuntu-latest
steps:
- name: Check issue activity
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const daysInactive = 8;
const label = 'Status: Update Requested';
const cutoffTime = new Date(Date.now() - daysInactive * 24 * 60 * 60 * 1000);
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
assignee: '*',
});
for (const issue of issues.data) {
const lastCommentTime = new Date(issue.updated_at);
if (lastCommentTime < cutoffTime) {
const assignees = issue.assignees.map(assignee => `@${assignee.login}`).join(', ');
const commentBody = `Hey ${assignees}! Thanks again for taking this issue.
Time for an update! Please comment the following update:
**Progress:** What's the status of the project? What have you done and what still needs to be done?
**Estimated Time to Completion (ETC):** When do you estimate to be finished?
**Blockers:** Anything preventing you from finishing?
Thanks again!
`;
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: [label],
});
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: commentBody,
});
}
}