-
Notifications
You must be signed in to change notification settings - Fork 62
feat(help): add detailed usage instructions and help flag to merge-pull-requests-by-title.sh #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joshjohanning
wants to merge
1
commit into
main
Choose a base branch
from
add-helper-text-to-pr-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+43
−20
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,19 +68,59 @@ | |
|
|
||
| merge_methods=("merge" "squash" "rebase") | ||
|
|
||
| print_help() { | ||
| echo "Find and merge pull requests matching a title pattern across multiple repositories" | ||
| echo "" | ||
| echo "Usage:" | ||
| echo " $0 <repo_list_file> <pr_title_pattern> [merge_method] [commit_title] [flags...]" | ||
| echo " $0 --owner <owner> <pr_title_pattern> [--topic <topic>]... [merge_method] [commit_title] [flags...]" | ||
| echo "" | ||
| echo "Required (one of):" | ||
| echo " repo_list_file - File with repository URLs (one per line)" | ||
| echo " --owner <owner> - Search repositories for this user or organization" | ||
| echo "" | ||
| echo "Required:" | ||
| echo " pr_title_pattern - Title pattern to match (exact match or use * for wildcard)" | ||
| echo "" | ||
| echo "Optional positional arguments:" | ||
| echo " merge_method - Merge method: merge, squash, or rebase (default: squash)" | ||
| echo " commit_title - Custom commit title for merged PRs (PR number is auto-appended; defaults to PR title)" | ||
| echo "" | ||
| echo "Flags:" | ||
| echo " -h, --help - Show this help message and exit" | ||
| echo " --topic <topic> - Filter --owner repositories by topic (can be specified multiple times)" | ||
| echo " --dry-run - Preview what would be merged without actually merging" | ||
| echo " --bump-patch-version - Clone each matching PR branch, run npm version patch, commit, and push" | ||
| echo " --enable-auto-merge - Enable auto-merge on matching PRs" | ||
| echo " --no-prompt - Merge without interactive confirmation" | ||
| echo "" | ||
| echo "Flag compatibility:" | ||
| echo " --dry-run and --bump-patch-version are mutually exclusive" | ||
| echo " --dry-run and --enable-auto-merge are mutually exclusive" | ||
| echo " --topic requires --owner" | ||
| echo "" | ||
| echo "Examples:" | ||
| echo " $0 repos.txt \"chore(deps)*\" --dry-run" | ||
| echo " $0 repos.txt \"chore(deps)*\" --bump-patch-version --enable-auto-merge" | ||
| echo " $0 --owner joshjohanning --topic github-action \"chore(deps)*\" --no-prompt" | ||
| } | ||
|
|
||
| # Check for flags and valued options | ||
| dry_run=false | ||
| bump_patch_version=false | ||
| enable_auto_merge=false | ||
| no_prompt=false | ||
| search_owner="" | ||
| topics=() | ||
| valid_flags=("--dry-run" "--bump-patch-version" "--enable-auto-merge" "--no-prompt" "--owner" "--topic") | ||
| valid_flags=("-h" "--help" "--dry-run" "--bump-patch-version" "--enable-auto-merge" "--no-prompt" "--owner" "--topic") | ||
| args=("$@") | ||
| i=0 | ||
| while [ $i -lt ${#args[@]} ]; do | ||
| arg="${args[$i]}" | ||
| if [ "$arg" = "--dry-run" ]; then | ||
| if [ "$arg" = "--help" ] || [ "$arg" = "-h" ]; then | ||
| print_help | ||
| exit 0 | ||
| elif [ "$arg" = "--dry-run" ]; then | ||
|
Comment on lines
+115
to
+123
|
||
| dry_run=true | ||
| elif [ "$arg" = "--bump-patch-version" ]; then | ||
| bump_patch_version=true | ||
|
|
@@ -116,24 +156,7 @@ while [ $i -lt ${#args[@]} ]; do | |
| done | ||
|
|
||
| if [ $# -lt 2 ]; then | ||
| echo "Usage: $0 <repo_list_file> <pr_title_pattern> [merge_method] [commit_title] [flags...]" | ||
| echo " $0 --owner <owner> <pr_title_pattern> [--topic <topic>]... [merge_method] [commit_title] [flags...]" | ||
| echo "" | ||
| echo "Required (one of):" | ||
| echo " repo_list_file - File with repository URLs (one per line)" | ||
| echo " --owner <owner> - Search repositories for this user or organization" | ||
| echo "" | ||
| echo "Required:" | ||
| echo " pr_title_pattern - Title pattern to match (use * for wildcard)" | ||
| echo "" | ||
| echo "Optional:" | ||
| echo " merge_method - merge, squash, or rebase (default: squash)" | ||
| echo " commit_title - Custom commit title for merged PRs (defaults to PR title)" | ||
| echo " --topic <topic> - Filter --owner repositories by topic (repeatable)" | ||
| echo " --dry-run - Preview what would be merged (cannot combine with --bump-patch-version or --enable-auto-merge)" | ||
| echo " --bump-patch-version - Bump npm patch version on each matching PR branch and push (cannot combine with --dry-run)" | ||
| echo " --enable-auto-merge - Enable auto-merge on matching PRs (can combine with --bump-patch-version, cannot combine with --dry-run)" | ||
| echo " --no-prompt - Merge without interactive confirmation" | ||
| print_help | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--bump-patch-versionhelp text omits a key behavioral detail: when this flag is used without--enable-auto-merge, the script only bumps/commits/pushes and does not merge PRs. Updating the help output to mention this would prevent users from assuming a merge will happen.