Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/open-ish/utility
Browse files Browse the repository at this point in the history
  • Loading branch information
tassioFront committed Nov 6, 2024
2 parents aae4c6e + bc3df5b commit f4ecceb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 32 deletions.
7 changes: 7 additions & 0 deletions packages/dependabot-pr-manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [1.5.0](https://github.com/open-ish/utility/compare/dependabot-pr-manager-v1.4.0...dependabot-pr-manager-v1.5.0) (2024-11-06)


### Features

* avoid prompt on ci ([78c5c65](https://github.com/open-ish/utility/commit/78c5c65eea3ea59d5248bfbbbc3e920e1c3f8321))

# [1.4.0](https://github.com/open-ish/utility/compare/dependabot-pr-manager-v1.3.2...dependabot-pr-manager-v1.4.0) (2024-11-06)


Expand Down
32 changes: 1 addition & 31 deletions packages/dependabot-pr-manager/src/lib/close-dependabot-prs.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node
import readline from 'readline';

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

import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';

Expand Down Expand Up @@ -30,8 +28,6 @@ const GITHUB_TOKEN = argv.githubToken;
const REPO_OWNER = argv.repoOwner;
const REPO_NAME = argv.repoName;

// Constants (update it according to your needs)

const colors = {
reset: '\x1b[0m',
blue: '\x1b[34m',
Expand Down Expand Up @@ -90,21 +86,6 @@ async function closeDependabotPRs(prs) {
);
}

// Prompt user for confirmation
function promptUser(question) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

return new Promise((resolve) => {
rl.question(question, (answer) => {
rl.close();
resolve(answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y');
});
});
}

async function main() {
console.log(`${colors.blue}Starting the process...${colors.reset}`);
const dependabotPRs = await getDependabotPRs();
Expand All @@ -113,21 +94,10 @@ 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 {
console.log(
`${colors.blue}Operation cancelled by the user.${colors.reset}`
);
}
await closeDependabotPRs(dependabotPRs);
}

main().catch((error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async function main() {
},
owner: REPO_OWNER,
repo: repoName,
title: 'ci: combined Dependabot Updates',
title: 'ci: update dependencies by dependabot-pr-manager',
head: COMBINED_BRANCH,
base: MAIN_BRANCH,
body: prBody,
Expand Down

0 comments on commit f4ecceb

Please sign in to comment.