Produces a shields.io Markdown badge reflecting the current reproducibility status of a project. The badge is colour-coded:
Green (
reproducible) – no risks detected.Yellow (
caution) – medium-severity risks only.Red (
at risk) – one or more high-severity risks or drifted outputs.Grey (
unknown) – no risk information supplied.
Can be inserted automatically into a README.md (e.g. from a GitHub
Actions workflow).
Usage
repro_badge(
audit,
risks = NULL,
drift = NULL,
output = "markdown",
readme_path = "README.md"
)Arguments
- audit
An
audit_reportfromaudit_script().- risks
A
risk_reportfromrisk_score(). Optional.- drift
A
drift_reportfromcheck_drift(). Optional.- output
character(1)."markdown"(return the badge string) or"README"(insert/update the badge inREADME.md). Default"markdown".- readme_path
character(1). Path to the README file whenoutput = "README". Default"README.md".
Examples
script <- tempfile(fileext = ".R")
writeLines("x <- dplyr::filter(mtcars, cyl == 4)", script)
report <- audit_script(script, renv = FALSE, verbose = FALSE)
risks <- risk_score(report)
badge <- repro_badge(report, risks)
#> [](https://repro-stats.github.io/reproducr/)
cat(badge)
#> [](https://repro-stats.github.io/reproducr/)