Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update badges #1594

Open
Tracked by #102 ...
jennybc opened this issue Feb 28, 2022 · 2 comments
Open
Tracked by #102 ...

How to update badges #1594

jennybc opened this issue Feb 28, 2022 · 2 comments
Labels
feature a feature request or enhancement readme 🏠 Readme, badges, ... tidy ✨ tools for the tidyverse team

Comments

@jennybc
Copy link
Member

jennybc commented Feb 28, 2022

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

@hadley
Copy link
Member

hadley commented Mar 1, 2022

Should we wait on #1554 before doing this systematically?

@jennybc
Copy link
Member Author

jennybc commented Mar 1, 2022

Sure. I don't see any urgency around this. (Although I have been doing it whenever I work on a package.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement readme 🏠 Readme, badges, ... tidy ✨ tools for the tidyverse team
Projects
None yet
Development

No branches or pull requests

2 participants