Skip to content

Commit 5b3f6ee

Browse files
committed
Use the GitHub API to query the merge-base.
1 parent eb4f56d commit 5b3f6ee

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

Manifest.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ version = "1.2.1"
173173

174174
[[deps.GitHub]]
175175
deps = ["Base64", "Dates", "HTTP", "JSON", "MbedTLS", "Sockets", "SodiumSeal", "URIs"]
176-
git-tree-sha1 = "86e4a22eb548b5dea5a16eab388b4921020c0b8c"
176+
git-tree-sha1 = "08ee34cdc529bd4e631f661595c2eb695515bdbc"
177177
uuid = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
178-
version = "5.8.0"
178+
version = "5.8.1"
179179

180180
[[deps.Git_jll]]
181181
deps = ["Artifacts", "Expat_jll", "Gettext_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "PCRE2_jll", "Pkg", "Zlib_jll"]

src/jobs/BenchmarkJob.jl

+4-9
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,10 @@ function BenchmarkJob(submission::JobSubmission)
7272
against = againstbuild
7373
elseif submission.prnumber !== nothing
7474
# if there is a PR number, we compare against the base branch
75-
repo = joinpath(workdir, "julia")
76-
if isdir(joinpath(repo, ".git"))
77-
gitreset!(repo)
78-
else
79-
gitclone!(submission.config.trackrepo, repo)
80-
end
81-
run(`$(git()) -C $repo fetch --quiet origin +refs/pull/$(submission.prnumber)/head:`)
82-
merge_base = chomp(read(`$(git()) -C $repo merge-base origin/master FETCH_HEAD`, String))
83-
against = commitref(submission.config, submission.config.trackrepo, merge_base)
75+
merge_base = GitHub.compare(submission.config.trackrepo,
76+
"master", "refs/pull/$(submission.prnumber)/head";
77+
auth=config.auth).merge_base_commit
78+
against = commitref(submission.config, submission.config.trackrepo, merge_base.sha)
8479
else
8580
against = nothing
8681
end

src/jobs/PkgEvalJob.jl

+4-9
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,10 @@ function PkgEvalJob(submission::JobSubmission)
112112
against = againstbuild
113113
elseif submission.prnumber !== nothing
114114
# if there is a PR number, we compare against the base branch
115-
repo = joinpath(workdir, "julia")
116-
if isdir(joinpath(repo, ".git"))
117-
gitreset!(repo)
118-
else
119-
gitclone!(submission.config.trackrepo, repo)
120-
end
121-
run(`$(git()) -C $repo fetch --quiet origin +refs/pull/$(submission.prnumber)/head:`)
122-
merge_base = chomp(read(`$(git()) -C $repo merge-base origin/master FETCH_HEAD`, String))
123-
against = commitref(submission.config, submission.config.trackrepo, merge_base)
115+
merge_base = GitHub.compare(submission.config.trackrepo,
116+
"master", "refs/pull/$(submission.prnumber)/head";
117+
auth=config.auth).merge_base_commit
118+
against = commitref(submission.config, submission.config.trackrepo, merge_base.sha)
124119
else
125120
against = nothing
126121
end

0 commit comments

Comments
 (0)