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

get default branch #25

Merged
merged 2 commits into from
Oct 30, 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/T4ARegistrator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function register(package::Union{Module,Nothing} = nothing)
current_branch in ["main", "master"] || error("""You are working on "$(current_branch)".
Please checkout on the default branch i.e., "main" or "master".
""")
defaultbranch = deepcopy(current_branch)

d = Dict()
local pkg
Expand Down Expand Up @@ -71,14 +72,13 @@ function register(package::Union{Module,Nothing} = nothing)
end

@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

pr_title = "$(LocalRegistry.commit_title(pkg, new_package))"

tree_hash, _, _ = LocalRegistry.get_tree_hash(package_dir, gitconfig)

pr_body = "UUID: $(pkg.uuid)\nRepo: $(package_repo)\nTree: $(string(tree_hash))"
command = "gh pr create --repo tensor4all/T4ARegistry --base $(basebranch) --head $(branch) --title \"$(pr_title)\" --body \"$(pr_body)\""
command = "gh pr create --repo tensor4all/T4ARegistry --base $(defaultbranch) --head $(branch) --title \"$(pr_title)\" --body \"$(pr_body)\""
println(command)
@info "Hint: you can merge the pull request via GitHub CLI:"
println("gh pr merge --repo tensor4all/T4ARegistry $(branch) --merge --auto --delete-branch")
Expand Down
Loading