Skip to content

Commit 94c9d37

Browse files
add an additional check for name
1 parent fdba5c2 commit 94c9d37

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

bench/01-declarations.R

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ plot_against_base <- function(new_bm,
1818
# if a pull request
1919
reference <- bm[commit_is_reference, "benchmarks"][[1]][[1]]
2020
# if benchmark exists in base branch
21-
reference <- reference %>%
22-
dplyr::filter(.data$name %in% !!name)
23-
if (nrow(reference) > 0) {
24-
# if benchmark exists in base branch
25-
reference$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_BASE_REF"))
26-
new_bm <- dplyr::bind_rows(reference, new_bm)
27-
stopifnot(nrow(new_bm) == 2)
28-
diff_in_percent <- round(100 * diff(new_bm$p50) / new_bm$p50[1])
29-
pr_comment <- glue::glue("* {name}: {new_bm$p50[1]} -> {new_bm$p50[2]} ({diff_in_percent}%)\n")
30-
cat(pr_comment, file = "pr-comment/info.txt", append = TRUE)
21+
if ("name" %in% names(reference)) {
22+
reference <- reference %>%
23+
dplyr::filter(.data$name %in% !!name)
24+
if (nrow(reference) > 0) {
25+
# if benchmark exists in base branch
26+
reference$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_BASE_REF"))
27+
new_bm <- dplyr::bind_rows(reference, new_bm)
28+
stopifnot(nrow(new_bm) == 2)
29+
diff_in_percent <- round(100 * diff(new_bm$p50) / new_bm$p50[1])
30+
pr_comment <- glue::glue("* {name}: {new_bm$p50[1]} -> {new_bm$p50[2]} ({diff_in_percent}%)\n")
31+
cat(pr_comment, file = "pr-comment/info.txt", append = TRUE)
32+
}
3133
}
3234
}
3335
new_bm$branch <- factor(new_bm$expression)

0 commit comments

Comments
 (0)