RegistryCI.jl
RegistryCI.jl copied to clipboard
TagBot: fixup PR creation fails with invalid base
https://github.com/JuliaRegistries/General/runs/1513863303?check_suite_focus=true
I'm guessing fork.default_branch
is null but I haven't been able to reproduce.
In this case, I wonder if the fix is:
- Delete the fork
- Re-fork the repo
Also, if the issue is that we don't know what the default branch is, we can always just use this:
function get_default_branch_name(owner::AbstractString, repo::AbstractString)
original_directory = pwd()
dir = mktempdir(; cleanup = true)
cd(dir)
run(`git clone https://github.com/$(owner)/$(repo).git CLONE`)
cd("CLONE")
default_branch_name = chomp(read(`git rev-parse --abbrev-ref HEAD`, String))
cd(original_directory)
rm(dir; force = true, recursive = true)
return default_branch_name
end
E.g.:
julia> default_branch_name = get_default_branch_name("JuliaRegistries", "RegistryCI.jl")
Cloning into 'CLONE'...
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 2070 (delta 17), reused 27 (delta 12), pack-reused 2028
Receiving objects: 100% (2070/2070), 877.82 KiB | 2.49 MiB/s, done.
Resolving deltas: 100% (1140/1140), done.
"master"
julia> @info "" default_branch_name
┌ Info:
└ default_branch_name = "master"
It should be simpler, just doing a get_repo
on the upstream ought to give us the default branch. I'll look into this tomorrow.
edit: s/tomorrow/EVENTUALLY/