ADD: old comments cleanup for the reminder; plus skip labels for the reminder; REF: remove some deps
This commit is contained in:
parent
f47929e07f
commit
f29d5265a0
5
package-lock.json
generated
5
package-lock.json
generated
@ -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",
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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", {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import * as core from "@actions/core";
|
||||
import * as github from "@actions/github";
|
||||
|
||||
const token = process.env.TOKEN;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user