Skip to content

Commit

Permalink
Merge pull request #58 from open-ish/fix/n-verify-commits
Browse files Browse the repository at this point in the history
Fix/n verify commits
  • Loading branch information
tassioFront authored Nov 6, 2024
2 parents cc7ddd2 + fdbd2a9 commit c1d7c59
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
10 changes: 10 additions & 0 deletions packages/dependabot-pr-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,13 @@ jobs:
- merge-dependabot-prs Job: This job runs the merge-dependabot-prs script to group and merge Dependabot PRs.
- close-dependabot-prs Job: This job runs the close-dependabot-prs script to close the Dependabot PRs when the pull request created from dependabot-pr-manager be commented with `'[dependabot-pr-manager] close prs'`.
## Package params
- `--repoUrl`(required): The repository URL;
- `--combinedBranch`(required): The branch that will be created with the combined PRs;
- `--mainBranch`(required): The main branch of the repository;
- `--githubToken`(required): The GitHub token;
- `--repoOwner`(required): The repository owner;
- `--repoName`(required): The repository name;
- `installDepsCommand`: The command to install the dependencies. Default: `yarn install`
2 changes: 1 addition & 1 deletion packages/dependabot-pr-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
"author": {
"name": "Open-ish"
},
"readme": "README.md"
"readme": "./README.md"
}
12 changes: 10 additions & 2 deletions packages/dependabot-pr-manager/src/lib/merge-dependabot-prs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ const argv = yargs(hideBin(process.argv))
description: 'Repository name',
type: 'string',
demandOption: true,
})
.option('installDepsCommand', {
alias: 'i',
description: 'Command to install dependencies - default is yarn install',
type: 'string',
default: 'yarn install',
demandOption: false,
}).argv;

// Constants from command-line arguments
Expand All @@ -53,6 +60,7 @@ const MAIN_BRANCH = argv.mainBranch;
const GITHUB_TOKEN = argv.githubToken;
const REPO_OWNER = argv.repoOwner;
const REPO_NAME = argv.repoName;
const INSTALL_DEPS_COMMAND = argv.installDepsCommand;

const colors = {
reset: '\x1b[0m',
Expand Down Expand Up @@ -154,15 +162,15 @@ async function main() {
const dependencies = await extractDependencies(dependabotPRs);
updatePackageJson(dependencies);
console.log(`${colors.blue}Installing new dependencies...${colors.reset}`);
execSync('yarn install');
execSync(INSTALL_DEPS_COMMAND);
console.log(
`${colors.blue}Creating new branch ${COMBINED_BRANCH}...${colors.reset}`
);
execSync(`git checkout -b ${COMBINED_BRANCH}`);

console.log(`${colors.blue}Committing and pushing changes...${colors.reset}`);
execSync('git add .');
execSync('git commit -m "ci: combined dependabot updates"');
execSync('git commit -m "ci: combined dependabot updates" -n');
execSync(`git push origin ${COMBINED_BRANCH}`);

console.log(`${colors.blue}Creating pull request...${colors.reset}`);
Expand Down

0 comments on commit c1d7c59

Please sign in to comment.