forked from yardenshoham/gitea-backporter
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close issues with
status/needs-feedback
that were last updated more…
… than a month ago (#108) * Close issues with `status/needs-feedback` that were last updated more than a month ago We will close issues with the label `status/needs-feedback` if there is no new activity in the past month. Co-authored-by: silverwind <[email protected]>
- Loading branch information
1 parent
cd9cf57
commit aab91a4
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { addComment, closeIssue, fetchOpenIssuesWithLabel } from "./github.ts"; | ||
|
||
export const run = async () => { | ||
// get all issues with the label "status/needs-feedback" | ||
const issuesWithStatusNeedsFeedback = await fetchOpenIssuesWithLabel( | ||
"status/needs-feedback", | ||
); | ||
return Promise.all(issuesWithStatusNeedsFeedback.items.map(handleIssue)); | ||
}; | ||
|
||
// close issue if a month has passed since it was last updated | ||
const handleIssue = async (issue: { | ||
number: number; | ||
updated_at: string; | ||
}) => { | ||
const oneMonthAgo = (new Date(Date.now() - 1000 * 60 * 60 * 24 * 30)) | ||
.getTime(); | ||
if ((new Date(issue.updated_at)).getTime() < oneMonthAgo) { | ||
console.log(`Closing issue #${issue.number} due to feedback timeout`); | ||
await addComment( | ||
issue.number, | ||
`We close issues that need feedback from the author if there were no new comments for a month. :tea:`, | ||
); | ||
|
||
// close issue | ||
await closeIssue(issue.number); | ||
} | ||
}; |
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
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