ADD: old comments cleanup for the reminder; plus skip labels for the reminder; REF: remove some deps

This commit is contained in:
Overtorment 2021-07-30 12:18:29 +01:00
parent f47929e07f
commit f29d5265a0
4 changed files with 37 additions and 8 deletions

5
package-lock.json generated
View File

@ -4,11 +4,6 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@actions/core": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
},
"@actions/github": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz",

View File

@ -15,7 +15,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"@actions/core": "^1.2.5",
"@actions/github": "^4.0.0",
"ts-node": "^9.0.0",
"typescript": "^4.0.2"

View File

@ -1,4 +1,3 @@
import * as core from "@actions/core";
import * as github from "@actions/github";
const token = process.env.TOKEN;
@ -20,6 +19,43 @@ async function run(): Promise<void> {
for (const pr of pullRequests) {
console.log(`${pr.title} (${pr.number})`);
let thereAreBlockerLabels = false;
for (const label of pr.labels) {
if (label.name.toUpperCase().startsWith("DO NOT MERGE") || label.name.toUpperCase().startsWith("WIP")) {
thereAreBlockerLabels = true;
}
}
if (thereAreBlockerLabels) continue;
// cleaning up old glados comments.
// comments are sorted by default
const comments = await octokit.request(
"GET " + pr.comments_url + "?per_page=1000"
);
if (comments?.data?.length >= 1) {
const filteredComments = comments.data.filter(
(c) => c?.user?.login === "GladosBlueWallet" && c?.body?.includes('Wake the fuck up samurai')
);
for (const comment of filteredComments) {
if (comment.created_at > new Date((+new Date()) - 24 * 3600 * 1000).toISOString()) {
continue;
}
console.warn("deleting old reminder comment", comment.id, "from PR", pr.number, 'dated', comment.created_at);
await octokit.request(
"DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}",
{
repo: "BlueWallet",
owner: "BlueWallet",
comment_id: comment.id,
}
);
}
}
// end comments cleanup
const _requestedReviewers = {};
const requestedReviews = await octokit.request("GET /repos/{owner}/{repo}/pulls/{ref}/requested_reviewers", {

View File

@ -1,4 +1,3 @@
import * as core from "@actions/core";
import * as github from "@actions/github";
const token = process.env.TOKEN;