Skip to content

Commit f536fe9

Browse files
ilyaZarColinFay
authored andcommitted
feature: use test coverage for current git-branch
- to clearly show what the testing coverage is on each branch via the badge - `README.Rmd` is altered to programatically retrieve the current git branch which automatically uses the correct coverage results from https://about.codecov.io/ Refs: #1086
1 parent 754a165 commit f536fe9

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.Rmd

+17-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,23 @@ knitr::opts_chunk$set(
1717

1818
<!-- badges: start -->
1919

20-
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) [![R-CMD-check](https://github.com/ThinkR-open/golem/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/golem/actions) [![Coverage status](https://codecov.io/gh/ThinkR-open/golem/branch/master/graph/badge.svg)](https://codecov.io/github/ThinkR-open/golem?branch=master) [![CRAN status](https://www.r-pkg.org/badges/version/golem)](https://cran.r-project.org/package=golem)
20+
```{r echo = FALSE}
21+
name_branch <- system("git symbolic-ref --short HEAD", intern = TRUE)
22+
link_to_branch_svg <- paste0(
23+
"https://codecov.io/gh/ThinkR-open/golem/branch/",
24+
name_branch,
25+
"/graph/badge.svg")
26+
link_to_branch_html <- paste0(
27+
"https://app.codecov.io/github/ThinkR-open/golem/tree/",
28+
name_branch)
29+
```
30+
31+
```{r, echo = FALSE, results = "asis"}
32+
cat('[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)')
33+
cat('[![R-CMD-check](https://github.com/ThinkR-open/golem/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/golem/actions)')
34+
cat(paste0("\n[![Coverage status](", link_to_branch_svg, ")](", link_to_branch_html, ")"))
35+
cat('[![CRAN status](https://www.r-pkg.org/badges/version/golem)](https://cran.r-project.org/package=golem)')
36+
```
2137

2238
<!-- badges: end -->
2339

0 commit comments

Comments
 (0)