@@ -17,23 +17,17 @@ plot_against_base <- function(new_bm,
17
17
if (any(commit_is_reference ) && Sys.getenv(" GITHUB_BASE_REF" ) != " " ) {
18
18
# if a pull request
19
19
reference <- bm [commit_is_reference , " benchmarks" ][[1 ]][[1 ]]
20
- if (" name" %in% names(reference )) {
20
+ # if benchmark exists in base branch
21
+ reference <- reference %> %
22
+ dplyr :: filter(.data $ name %in% !! name )
23
+ if (nrow(reference ) > 0 ) {
21
24
# if benchmark exists in base branch
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
- print(new_bm )
28
- print(new_bm $ name )
29
- print(reference )
30
- print(reference $ name )
31
- new_bm <- dplyr :: bind_rows(reference , new_bm )
32
- stopifnot(nrow(new_bm ) == 2 )
33
- diff_in_percent <- round(100 * diff(new_bm $ p50 ) / new_bm $ p50 [1 ])
34
- pr_comment <- glue :: glue(" * {name}: {new_bm$p50[1]} -> {new_bm$p50[2]} ({diff_in_percent}%)\n " )
35
- cat(pr_comment , file = " pr-comment/info.txt" , append = TRUE )
36
- }
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 )
37
31
}
38
32
}
39
33
new_bm $ branch <- factor (new_bm $ expression )
0 commit comments