Skip to content

Commit

Permalink
Merge pull request #21 from katilingban/dev
Browse files Browse the repository at this point in the history
create add_codecov function
  • Loading branch information
ernestguevarra committed May 1, 2024
2 parents fd6b165 + 2dd9911 commit 83323d3
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export(add_badge_codefactor)
export(add_badge_status)
export(add_badge_zenodo)
export(add_codecov)
export(add_contributing)
export(add_issue_template)
export(add_logo)
Expand Down
30 changes: 30 additions & 0 deletions R/add_codecov.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#'
#' Add Codecov token snippet
#'
#' @returns An entry in the `codecov.yml` file for Codecov token specifications
#' suitable for GitHub Actions.
#'
#' @examples
#' if (interactive()) add_codecov()
#'
#' @export
#'

add_codecov <- function() {
if (!file.exists("codecov.yml"))
return(FALSE)

codecov_lines <- readLines("codecov.yml")
codecov_lines <- c(
"codecov:",
" token: ${{ secrets.CODECOV_TOKEN }}",
"",
codecov_lines
)

## Append replacement text ----
writeLines(text = codecov_lines, con = "codecov.yml")

## Return TRUE if snippet was added ----
TRUE
}
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
codecov:
token: ${{ secrets.CODECOV_TOKEN }}

comment: false

coverage:
Expand Down
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Lifecycle
ORCID
WIP
Zenodo
codecov
cran
github
ke
Expand Down
19 changes: 19 additions & 0 deletions man/add_codecov.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ reference:
- add_badge_zenodo
- add_logo

- title: Code snippets
contents:
- add_codecov

- title: Document templates
contents:
- add_contributing
Expand Down

0 comments on commit 83323d3

Please sign in to comment.