Skip to content

How to update badges #1594

@jennybc

Description

@jennybc

The recommended badge snippet for GHA and Codecov has changed over time.

The dev version of usethis produces badges that match what GitHub's and Codecov's official badge helpers provide now.

If you have old badge syntax (which still seems to work, BTW), but you want to update, here's how.

Note that the Codecov badge update will be prompted by urlchecker::url_check(), i.e. you're going to have to do this one anyway, eventually.


This is a little fiddly, given how low impact it is. Our current/old badges do work, at least for the moment. But here's the deal anyway.

Reasons to update badges:

  • Part of finishing master --> main.
  • Use the URLs returned by GitHub's and Codecov's own official badge helpers / docs.

This requires dev usethis. The GHA update in question happened in aa510ec.

Pick one, to update GHA R-CMD-check badge:

  • use_tidy_github_actions() inserts an updated GHA badge in README, while doing its main job.
  • use_github_actions_badge("R-CMD-check") just inserts a badge.

To update a Codecov badge, you have to call an internal helper via ::::

  • usethis:::use_codecov_badge("OWNER/SPEC"), e.g. usethis:::use_codecov_badge("r-lib/gh")

Before committing new badges:

  • If this resulted in 2 badges in README.[R]?md, delete the old. Move the new into desired place.
  • Re-render README.Rmd with devtools::build_readme().

R-CMD-check badge:
Old svg: ...OWNER/REPO/workflows/R-CMD-check/badge.svg
New svg: ...OWNER/REPO/actions/workflows/R-CMD-check.yaml/badge.svg
Old URL: ...OWNER/REPO/actions
New URL: ...OWNER/REPO/actions/workflows/R-CMD-check.yaml

Codecov test coverage badge:
Old svg: probably mentions master
New svg: probably should mention main
Old URL: https://codecov.io/gh/OWNER/REPO?branch=master
New URL: https://app.codecov.io/gh/OWNER/REPO?branch=main

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementreadme 🏠Readme, badges, ...tidy ✨tools for the tidyverse team

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions