Skip to content

Commit 4e66530

Browse files
committed
Use shields.io badges for R-CMD-check and test coverage
1 parent cc1ac60 commit 4e66530

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

R/coverage.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use_covr_ignore <- function(files) {
4444
use_codecov_badge <- function(repo_spec) {
4545
default_branch <- git_default_branch()
4646
url <- glue("https://app.codecov.io/gh/{repo_spec}?branch={default_branch}")
47-
img <- glue("https://codecov.io/gh/{repo_spec}/branch/{default_branch}/graph/badge.svg")
47+
img <- glue("https://img.shields.io/codecov/c/github/{repo_spec}?label=test%20coverage&logo=codecov")
4848
use_badge("Codecov test coverage", url, img)
4949
}
5050

R/github-actions.R

+9-4
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,20 @@ use_github_actions <- function() {
7373
#' @rdname github_actions
7474
use_github_actions_badge <- function(name = "R-CMD-check.yaml",
7575
repo_spec = NULL) {
76+
name_no_ext <- path_ext_remove(name)
7677
if (path_ext(name) == "") {
7778
name <- path_ext_set(name, "yaml")
7879
}
80+
name_enc <- utils::URLencode(name)
81+
name_no_ext_enc <- utils::URLencode(name_no_ext)
82+
badge_label <- glue("{name_no_ext} GitHub Action status")
83+
7984
repo_spec <- repo_spec %||% target_repo_spec()
80-
enc_name <- utils::URLencode(name)
81-
img <- glue("https://github.com/{repo_spec}/actions/workflows/{enc_name}/badge.svg")
82-
url <- glue("https://github.com/{repo_spec}/actions/workflows/{enc_name}")
8385

84-
use_badge(path_ext_remove(name), url, img)
86+
img <- glue("https://img.shields.io/github/workflow/status/{repo_spec}/{name_no_ext_enc}?label={name_no_ext_enc}&logo=github")
87+
url <- glue("https://github.com/{repo_spec}/actions/workflows/{name_enc}")
88+
89+
use_badge(badge_label, url, img)
8590
}
8691

8792
uses_github_actions <- function() {

README.Rmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ knitr::opts_chunk$set(
1616
# usethis <img src="man/figures/logo.png" align="right" height="139" />
1717

1818
<!-- badges: start -->
19-
[![R-CMD-check](https://github.com/r-lib/usethis/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/usethis/actions/workflows/R-CMD-check.yaml)
20-
[![Codecov test coverage](https://codecov.io/gh/r-lib/usethis/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/usethis?branch=main)
19+
[![R-CMD-check GitHub Action status](https://img.shields.io/github/workflow/status/r-lib/usethis/R-CMD-check?label=R-CMD-check&logo=github)](https://github.com/r-lib/usethis/actions/workflows/R-CMD-check.yaml)
20+
[![Codecov test coverage](https://img.shields.io/codecov/c/github/r-lib/usethis?label=test%20coverage&logo=codecov)](https://app.codecov.io/gh/r-lib/usethis?branch=main)
2121
[![CRAN status](https://www.r-pkg.org/badges/version/usethis)](https://CRAN.R-project.org/package=usethis)
2222
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
2323
<!-- badges: end -->

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
<!-- badges: start -->
77

8-
[![R-CMD-check](https://github.com/r-lib/usethis/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/usethis/actions/workflows/R-CMD-check.yaml)
8+
[![R-CMD-check GitHub Action
9+
status](https://img.shields.io/github/workflow/status/r-lib/usethis/R-CMD-check?label=R-CMD-check&logo=github)](https://github.com/r-lib/usethis/actions/workflows/R-CMD-check.yaml)
910
[![Codecov test
10-
coverage](https://codecov.io/gh/r-lib/usethis/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/usethis?branch=main)
11+
coverage](https://img.shields.io/codecov/c/github/r-lib/usethis?label=test%20coverage&logo=codecov)](https://app.codecov.io/gh/r-lib/usethis?branch=main)
1112
[![CRAN
1213
status](https://www.r-pkg.org/badges/version/usethis)](https://CRAN.R-project.org/package=usethis)
1314
[![Lifecycle:

0 commit comments

Comments
 (0)