Skip to content

Commit cee4dae

Browse files
committed
When testing, do not authenticate to GitHub
When you try to deploy, we automatically try to authenticate to GitHub and ensure that we have write privileges to the appropriate account. Let's not do that when we're running `Pkg.test()` though.
1 parent 221394e commit cee4dae

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Universes.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ using Logging
1414

1515
export Universe, in_universe
1616

17+
const allow_github_authentication::Ref{Bool} = Ref(true)
18+
1719
function update_registries!(registries::Vector{RegistrySpec},
1820
depot_path::String;
1921
verbose::Bool = false)
@@ -129,9 +131,11 @@ struct Universe
129131
if deploy_org !== nothing
130132
# Authenticate to GitHub, then ensure that we are either deploying to our
131133
# user, or an organization we are a part of
132-
ensure_gh_authenticated()
133-
if deploy_org != gh_user() && deploy_org gh_orgs()
134-
throw(ArgumentError("deploy target '$(deploy)' not a user/organization we have access to!"))
134+
if allow_github_authentication[]
135+
ensure_gh_authenticated()
136+
if deploy_org != gh_user() && deploy_org gh_orgs()
137+
throw(ArgumentError("deploy target '$(deploy)' not a user/organization we have access to!"))
138+
end
135139
end
136140
end
137141

test/BuildMetaTests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ using Test, BinaryBuilder2, Pkg
22
using BinaryBuilder2: parse_build_tarballs_args, universes_dir
33
using Base.BinaryPlatforms
44

5+
# Ensure that, when testing, we do not attempt to authenticate to GitHub
6+
BinaryBuilder2.allow_github_authentication[] = false
57
@testset "BuildMeta" begin
68
@testset "parse_build_tarballs_args" begin
79
# Ensure that we get very simple defaults for no args

0 commit comments

Comments
 (0)