Skip to content

feat: add --bump-patch-version and --no-prompt flags to merge-pull-requests-by-title.sh#158

Open
Copilot wants to merge 5 commits intomainfrom
copilot/bump-patch-version-in-script
Open

feat: add --bump-patch-version and --no-prompt flags to merge-pull-requests-by-title.sh#158
Copilot wants to merge 5 commits intomainfrom
copilot/bump-patch-version-in-script

Conversation

Copy link

Copilot AI commented Mar 18, 2026

When a Dependabot PR updates a prod dependency, CI often requires a patch version bump before the PR can merge. Previously this meant manually cloning, switching branches, running npm version patch, committing, and pushing for each affected repo. Additionally, the merge command previously auto-merged all matching PRs without any confirmation.

Changes

  • New --bump-patch-version flag – mutually exclusive with --dry-run; finds matching PRs, clones each branch, bumps the npm patch version, and pushes
  • Authenticated clone via gh repo clone – handles private repos without extra credential setup
  • package-lock.json staged if present – gracefully skips if absent
  • Commit message: chore: bump version to <version>
  • Summary output uses "Bumped" label and reminds to wait for CI before merging
  • Interactive confirmation by default – merge mode now prompts ❓ Merge owner/repo#N? [y/N] before each PR; declining increments the "Skipped" counter
  • New --no-prompt flag – skips the per-PR confirmation and merges all matching PRs automatically
  • README updated with usage examples for both new flags

Usage

# Bump patch version on all matching PR branches, then wait for CI before merging
./merge-pull-requests-by-title.sh repos.txt "chore(deps)*" squash "" --bump-patch-version

# Once CI passes, merge with interactive confirmation (default)
./merge-pull-requests-by-title.sh repos.txt "chore(deps)*" squash ""

# Merge all matching PRs without confirmation prompt
./merge-pull-requests-by-title.sh repos.txt "chore(deps)*" squash "" --no-prompt
Original prompt

I use the gh-cli/merge-pull-requests-by-title.sh script to manage my action repos, namely meeting in like Dependabot PRs. Sometimes the Dependabot PR is updating a prod dependency, and I can't merge without bump the patch version.

What I have to do then is locally open up the repo, pull latest, switch to right branch, run npm version patch --no-git-tag-version, commit the change, and push, then the PR should be ready to merge.

In this script, can we introduce a --bump-patch-version that I would run kind of like '--dry-run- it wouldn't be ran with the merge command or dry run. The idea is I would run the bump command, it would clone to a temp dir and do the above (ideally the commit message would indicate:chore: bunk version to $ver`), and then push. CI has to run and pass before I can merge.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…-title.sh

Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Copilot AI changed the title [WIP] Add --bump-patch-version option to script feat(gh-cli): add --bump-patch-version flag to merge-pull-requests-by-title.sh Mar 18, 2026
Copilot AI requested a review from joshjohanning March 18, 2026 04:01
@joshjohanning
Copy link
Owner

@copilot I also think that the merge should have a --merge or --confirm flag so it doesn't jsut auto merge without confirmation on this guy... lilke maybe default is interactively and there is a --confirm or --no-confirm or maybe --no-prompt that does it without prompting

Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Copy link
Author

Copilot AI commented Mar 18, 2026

@copilot I also think that the merge should have a --merge or --confirm flag so it doesn't jsut auto merge without confirmation on this guy... lilke maybe default is interactively and there is a --con...

Added in 8a1fd57. Merge mode now prompts ❓ Merge owner/repo#N? [y/N] before each PR by default. Pass --no-prompt to skip the confirmation and merge all matching PRs automatically. PRs declined at the prompt are counted in the "Skipped" summary. --dry-run and --bump-patch-version are unaffected (never interactive).

Copilot AI changed the title feat(gh-cli): add --bump-patch-version flag to merge-pull-requests-by-title.sh feat(gh-cli): add --bump-patch-version and --no-prompt flags to merge-pull-requests-by-title.sh Mar 18, 2026
@joshjohanning joshjohanning marked this pull request as ready for review March 18, 2026 14:32
Copilot AI review requested due to automatic review settings March 18, 2026 14:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the merge-pull-requests-by-title.sh gh-cli helper to add safer merge behavior (optional per-PR confirmation) and a new mode to bump npm patch versions on matching PR branches before merging, along with corresponding README documentation updates.

Changes:

  • Add --no-prompt to allow non-interactive batch merging without per-PR confirmation
  • Add --bump-patch-version mode to clone matching PR branches, run an npm patch bump, commit, and push
  • Update gh-cli/README.md usage examples and script description to reflect the new flags/mode

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
gh-cli/README.md Documents new --no-prompt behavior and adds --bump-patch-version example usage
gh-cli/merge-pull-requests-by-title.sh Implements confirmation prompting, branch extraction, and npm patch bump workflow

You can also share your feedback on Copilot code review. Take the survey.

@joshjohanning joshjohanning requested a review from Copilot March 18, 2026 20:09
@joshjohanning joshjohanning requested review from Copilot and removed request for Copilot March 18, 2026 20:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new operational modes and safety controls to the merge-pull-requests-by-title.sh script to better handle Dependabot PR workflows that require an npm patch version bump and to avoid unintended bulk merges.

Changes:

  • Added --bump-patch-version mode to clone PR branches, bump npm patch version, commit, and push (optionally enabling auto-merge).
  • Added interactive per-PR merge confirmation by default, plus --no-prompt to merge without confirmation.
  • Updated matching PR query output to include branch names and refreshed README usage examples.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
gh-cli/merge-pull-requests-by-title.sh Adds bump-and-push workflow, auto-merge support, interactive prompting, and updated PR querying/filters.
gh-cli/README.md Documents new flags and provides updated usage examples.

You can also share your feedback on Copilot code review. Take the survey.

@joshjohanning joshjohanning changed the title feat(gh-cli): add --bump-patch-version and --no-prompt flags to merge-pull-requests-by-title.sh feat: add --bump-patch-version and --no-prompt flags to merge-pull-requests-by-title.sh Mar 18, 2026
@joshjohanning joshjohanning requested a review from Copilot March 18, 2026 20:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the gh-cli/merge-pull-requests-by-title.sh utility to support optionally bumping npm patch versions on matching PR branches (to satisfy CI requirements) and to make batch merging safer via per-PR confirmation (with an opt-out flag).

Changes:

  • Add --bump-patch-version mode to clone matching PR branches, run npm version patch, commit, and push (optionally enabling auto-merge)
  • Add interactive confirmation before each merge by default, plus --no-prompt to merge without confirmation
  • Update gh-cli/README.md usage examples to document the new flags

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
gh-cli/merge-pull-requests-by-title.sh Implements new bump mode, auto-merge support, and default interactive confirmation for merges
gh-cli/README.md Documents updated behavior and adds examples for --bump-patch-version and --no-prompt

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +314 to +315
if ! [[ -t 0 ]]; then
echo "Error: No TTY available for interactive prompt - use --no-prompt"
Comment on lines +110 to +113
repo_list_file=${positional_args[0]}
pr_title_pattern=${positional_args[1]}
merge_method=${positional_args[2]:-squash}
commit_title=${positional_args[3]:-}
@@ -31,44 +40,88 @@
# - PRs must be open and in a mergeable state
# - Use * as a wildcard in the title pattern (e.g., "chore(deps)*" matches any title starting with "chore(deps)")
# - If multiple PRs match in a repo, all will be listed but only the first will be merged (use --dry-run to preview)
@@ -128,16 +181,33 @@ while IFS= read -r repo_url || [ -n "$repo_url" ]; do
jq_pattern="${jq_pattern//$/\\$}"
jq_pattern="${jq_pattern//|/\\|}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants