Skip to content
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

Refer the default branch #26

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/PkgBump/PkgBump.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function bump(mode::Symbol; commit::Bool = true, push::Bool = true)::Nothing
error("""You are working on "$(current_branch)".
Please checkout on the default branch i.e., "main" or "master".
""")
defaultbranch = deepcopy(current_branch)

if commit
!LibGit2.isdirty(repo) ||
Expand Down Expand Up @@ -58,8 +59,7 @@ function bump(mode::Symbol; commit::Bool = true, push::Bool = true)::Nothing
@info "Push to origin..."
run(`git -C $(project_dir) push --set-upstream origin $branch`)
@info "Hint: you can create a new pull request to GitHub repository via GitHub CLI:"
basebranch = readchomp(`git -C . rev-parse --abbrev-ref HEAD`) # e.g., main or master
@info "gh pr create --base $(basebranch) --head $(branch) --title \"Bump version to $(new_version)\" --body \"This PR updates version to $(new_version)\""
@info "gh pr create --base $(defaultbranch) --head $(branch) --title \"Bump version to $(new_version)\" --body \"This PR updates version to $(new_version)\""
@info "Hint: you can merge the pull request via GitHub CLI:"
@info "gh pr merge $(branch) --merge --auto --delete-branch"
else
Expand Down
Loading