Skip to content

Commit

Permalink
ci: add pr links
Browse files Browse the repository at this point in the history
  • Loading branch information
tassioFront committed Sep 5, 2024
1 parent c080ba0 commit 4ff80b3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/close-dependabot-prs.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Octokit } from '@octokit/rest';
import readline from 'readline';

import { Octokit } from '@octokit/rest';

/* requirements
* 0. Install Node.js
* 1. Install @octokit/rest package as DevDependencies (npm install @octokit/rest --save-dev)
Expand Down Expand Up @@ -40,12 +41,14 @@ async function getDependabotPRs() {
const dependabotPRs = pullRequests.filter(
(pr) => pr.user.login === 'dependabot[bot]'
);

console.log(
`${colors.green}Found ${dependabotPRs.length} Dependabot pull requests. 🤖 ${colors.reset}`
);
dependabotPRs.forEach((pr) => {
console.log(`${colors.yellow}${pr.title}${colors.reset}`);
console.log(`${colors.yellow}[${pr.title}](${pr.html_url})${colors.reset}`);
});

return dependabotPRs;
}

Expand Down Expand Up @@ -95,12 +98,14 @@ async function main() {
console.log(
`${colors.green}No open Dependabot pull requests found.${colors.reset}`
);

return;
}

const confirm = await promptUser(
`${colors.blue}Do you want to close all open Dependabot pull requests? (yes/no): ${colors.reset}`
);

if (confirm) {
await closeDependabotPRs(dependabotPRs);
} else {
Expand All @@ -117,6 +122,7 @@ main().catch((error) => {
);
process.exit;
}

console.error(`${colors.red}${error}${colors.reset}`);
process.exit(1);
});

0 comments on commit 4ff80b3

Please sign in to comment.