Skip to content

Commit

Permalink
Update issue-pr-reminder.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
csehatt741 authored Feb 17, 2025
1 parent bb3ee92 commit 381e554
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions .github/workflows/issue-pr-reminder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Issue PR Reminder

on:
schedule:
- cron: '0 * * * *' # Runs every hour, at the start of each hour
- cron: '0 * * * *' # Runs every hour
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -68,34 +68,38 @@ jobs:
return allIssues;
}
const issues = await listOpenIssuesWithoutPR();
async function createReminders() {
const issues = await listOpenIssuesWithoutPR();
issues.forEach(issue => {
const issueCreatedAt = new Date(issue.created_at);
const createReminderAfter = issueCreatedAt.setHours(issueCreatedAt.getHours() + createReminderAfterHours);
for (const issue of issues) {
const issueCreatedAt = new Date(issue.created_at);
const createReminderAfter = issueCreatedAt.setHours(issueCreatedAt.getHours() + createReminderAfterHours);
// Check if it's time to create the reminder
if(now < createReminderAfter) {
return;
}
// Check if it's time to create the reminder
if (now < createReminderAfter) {
continue;
}
// Create reminder for each assignee
const comments = await listIssueComments(issue);
// Create reminder for each assignee
const comments = await listIssueComments(issue);
for (const assignee of issue.assignees) {
const reminder = `@${assignee.login}, please open a draft PR linking this issue!`;
issue.assignees.forEach(assignee => {
const reminder = `@${assignee.login}, please open a draft PR linking this issue!`;
// Check if the issue already has the reminder
if (comments.some(comment => comment.body === reminder)) {
continue;
}
// Check if the issue already has the reminder
if(comments.some(comment => comment.body === reminder)) {
return;
// Create the reminder
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: reminder
});
}
}
}
// Create the reminder
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: reminder
});
});
});
await createReminders();

0 comments on commit 381e554

Please sign in to comment.