Skip to content

Commit d559f50

Browse files
improve terminology
1 parent 87c2b87 commit d559f50

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

bench/01-declarations.R

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
#' Plot benchmarks against master, if benchmarks there exist
2-
#'
1+
#' Plot benchmarks against a base branch, if benchmarks there exist
32
#'
43
#' @param new_bm A new benchmark object.
54
#' @param new_bm_label The label of the new benchmark used as a title.
65
#' @param file The file path to write the plot.
7-
plot_against_master <- function(new_bm,
8-
new_bm_label = deparse(substitute(new_bm)),
9-
file = paste0("plots/", new_bm_label, ".pdf")) {
6+
plot_against_base <- function(new_bm,
7+
new_bm_label = deparse(substitute(new_bm)),
8+
file = paste0("plots/", new_bm_label, ".pdf")) {
109
new_bm <- bench::as_bench_mark(new_bm)
1110
branches <- gert::git_branch_list()
12-
master <- branches[branches$name == "master", "commit", drop = TRUE]
11+
last_commit_base_branch <- branches[branches$name == Sys.getenv("GITHUB_BASE_REF"), "commit", drop = TRUE]
1312
bm <- bench::cb_read()
14-
hash_is_master <- bm$commit_hash == master
15-
if (any(hash_is_master) && Sys.getenv("GITHUB_BASE_REF") != "") {
13+
commit_is_reference <- bm$commit_hash == last_commit_base_branch
14+
if (any(commit_is_reference) && Sys.getenv("GITHUB_BASE_REF") != "") {
1615
# if a pull request
17-
reference <- bm[hash_is_master, "benchmarks"][[1]][[1]]
16+
reference <- bm[commit_is_reference, "benchmarks"][[1]][[1]]
1817
reference$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_BASE_REF"))
1918
new_bm$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_HEAD_REF"))
2019
new_bm <- rbind(reference, new_bm)

0 commit comments

Comments
 (0)