From b462d8859f727e60790d2190b00b0f9cab705c3d Mon Sep 17 00:00:00 2001 From: IlyaZar Date: Wed, 9 Aug 2023 12:06:39 +0200 Subject: [PATCH] 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 --- README.Rmd | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.Rmd b/README.Rmd index 65253ad5..314ae7b2 100644 --- a/README.Rmd +++ b/README.Rmd @@ -17,7 +17,23 @@ knitr::opts_chunk$set( -[![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) +```{r echo = FALSE} +name_branch <- system("git symbolic-ref --short HEAD", intern = TRUE) +link_to_branch_svg <- paste0( + "https://codecov.io/gh/ThinkR-open/golem/branch/", + name_branch, + "/graph/badge.svg") +link_to_branch_html <- paste0( + "https://app.codecov.io/github/ThinkR-open/golem/tree/", + name_branch) +``` + +```{r, echo = FALSE, results = "asis"} +cat('[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)') +cat('[![R-CMD-check](https://github.com/ThinkR-open/golem/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/golem/actions)') +cat(paste0("\n[![Coverage status](", link_to_branch_svg, ")](", link_to_branch_html, ")")) +cat('[![CRAN status](https://www.r-pkg.org/badges/version/golem)](https://cran.r-project.org/package=golem)') +```