Open-Issue-Reminder #76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Open-Issue-Reminder" | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v5 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const threeDays = 259200000; // Milliseconds in 3 days | |
const now = Date.now(); | |
const issueList = await github.issues.listForRepo({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: 'open', | |
}); | |
for (const issue of issueList.data) { | |
const issueAge = now - issue.created_at; | |
if (issueAge > threeDays) { | |
const commentBody = `Hi there! This issue is still open. We are waiting for your response. | |
Assignees: ${issue.assignees.map(assignee => '@' + assignee.login).join(', ') || 'None'}`; | |
await github.issues.createComment({ | |
issue_number: issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: commentBody | |
}); | |
} | |
} |