From 2695d1af07acf1ab9f2f38742485ed3ace47932b Mon Sep 17 00:00:00 2001 From: Kathryn Doering Date: Mon, 15 Jul 2024 09:15:06 -0700 Subject: [PATCH] Issue 126: deprecate style only, style description only, and document only workflows (#131) * Remove R functions for description, style only, docs only workflows Partially addresses #126. * add warning about deprecation partially addresses #126 * run devtools::document() * fix: add date to deprecation msg --- .github/workflows/style-description.yml | 5 +++ .github/workflows/style-r-code.yml | 4 +++ .github/workflows/update-roxygen-docs.yml | 4 +++ NAMESPACE | 3 -- R/use_r_workflows.R | 40 ----------------------- README.md | 15 --------- inst/templates/call-style-description.yml | 17 ---------- inst/templates/call-style.yml | 12 ------- inst/templates/call-update-docs.yml | 11 ------- man/use_style_description.Rd | 16 --------- man/use_style_r_code.Rd | 15 --------- man/use_update_roxygen_docs.Rd | 15 --------- tests/testthat/test-use_r_workflows.R | 14 -------- 13 files changed, 13 insertions(+), 158 deletions(-) delete mode 100644 inst/templates/call-style-description.yml delete mode 100644 inst/templates/call-style.yml delete mode 100644 inst/templates/call-update-docs.yml delete mode 100644 man/use_style_description.Rd delete mode 100644 man/use_style_r_code.Rd delete mode 100644 man/use_update_roxygen_docs.Rd diff --git a/.github/workflows/style-description.yml b/.github/workflows/style-description.yml index d53f77e..a943fc7 100644 --- a/.github/workflows/style-description.yml +++ b/.github/workflows/style-description.yml @@ -24,6 +24,11 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Warn about workflow removal + run: | + echo "::warning title=Deprecating style-description workflow::The style-description reusable workflow will be deprecated on 5 December 2024. Use ghactions4r::use_style_and_document() instead to set up a replacement with additional functionality." + + - name: Install curl dependency run: | sudo apt-get update diff --git a/.github/workflows/style-r-code.yml b/.github/workflows/style-r-code.yml index f4ed7dd..43f1161 100644 --- a/.github/workflows/style-r-code.yml +++ b/.github/workflows/style-r-code.yml @@ -18,6 +18,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Warn about workflow removal + run: | + echo "::warning title=Deprecating style-r-code workflow::The style-r-code reusable workflow will be deprecated on 5 December 2024. Use ghactions4r::use_style_and_document() instead to set up a replacement with additional functionality." + - uses: r-lib/actions/setup-r@v2 - name: Install dependencies diff --git a/.github/workflows/update-roxygen-docs.yml b/.github/workflows/update-roxygen-docs.yml index d9efae4..43a62df 100644 --- a/.github/workflows/update-roxygen-docs.yml +++ b/.github/workflows/update-roxygen-docs.yml @@ -18,6 +18,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Warn about workflow removal + run: | + echo "::warning title=Deprecating update-roxygen-docs workflow::The update-roxygen-docs reusable workflow will be deprecated on 5 December 2024. Use ghactions4r::use_style_and_document() instead to set up a replacement with additional functionality." + - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true diff --git a/NAMESPACE b/NAMESPACE index 19f4e86..72807c7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,7 +8,4 @@ export(use_connect_publish) export(use_doc_and_style_r) export(use_r_cmd_check) export(use_spell_check) -export(use_style_description) -export(use_style_r_code) export(use_update_pkgdown) -export(use_update_roxygen_docs) diff --git a/R/use_r_workflows.R b/R/use_r_workflows.R index d0f813b..45017b6 100644 --- a/R/use_r_workflows.R +++ b/R/use_r_workflows.R @@ -204,46 +204,6 @@ use_build_pkgdown <- function(workflow_name = "call-build-pkgdown.yml") { ) } -#' use workflow in current pkg to run devtools::document() and submit results as a PR -#' @template workflow_name -#' @export -use_update_roxygen_docs <- function(workflow_name = "call-update-docs.yml") { - usethis::use_github_action("call-update-docs.yml", - save_as = workflow_name, - url = "https://raw.githubusercontent.com/nmfs-fish-tools/ghactions4r/main/inst/templates/call-update-docs.yml" - ) - usethis::use_git_ignore(ignores = "*.rds", directory = file.path(".github")) -} - -#' use workflow in current pkg to run `usethis::use_tidy_description()` -#' -#' Run `usethis::use_tidy_description()` upon changes to the DESCRIPTION file -#' and submit results as a PR. -#' @template workflow_name -#' @export -use_style_description <- function(workflow_name = "call-style-description.yml") { - check_workflow_name(workflow_name) - usethis::use_github_action( - "call-style-description.yml", - save_as = workflow_name, - url = "https://raw.githubusercontent.com/nmfs-fish-tools/ghactions4r/main/inst/templates/call-style-description.yml" - ) - usethis::use_git_ignore(ignores = "*.rds", directory = file.path(".github")) -} - -#' use workflow in current pkg to run styler::style_pkg() and submit results as a PR -#' @template workflow_name -#' @export -use_style_r_code <- function(workflow_name = "call-style.yml") { - check_workflow_name(workflow_name) - usethis::use_github_action("call-style.yml", - save_as = workflow_name, - url = "https://raw.githubusercontent.com/nmfs-fish-tools/ghactions4r/main/inst/templates/call-style.yml" - ) - usethis::use_git_ignore(ignores = "*.rds", directory = file.path(".github")) -} - - #' use workflow in current pkg to build and deploy (update) bookdown #' Builds the bookdown, then deploys it to a branch in the same repository called gh-pages. #' The repository must be diff --git a/README.md b/README.md index 5784de3..0cdda5b 100644 --- a/README.md +++ b/README.md @@ -47,21 +47,6 @@ ghactions4r::use_calc_coverage() ``` (a codecov.io account is also necessary to view the coverage results) -- To update documentation using `devtools::document()`: -```r -ghactions4r::use_update_roxygen_docs() -``` - -- To update R code styling using `styler::style_pkg()`: -```r -ghactions4r::use_style_r_code() -``` - -- To update the style of the DESCRIPTION file using `usethis::use_tidy_description()`: -```r -ghactions4r::use_style_description() -``` - - To update documentation, DESCRIPTION file, and code styling for an R package (with the option of running `ghactions4r::rm_dollar_sign()`): ```r ghactions4r::use_doc_and_style_r(use_rm_dollar_sign = FALSE) diff --git a/inst/templates/call-style-description.yml b/inst/templates/call-style-description.yml deleted file mode 100644 index b5fd16b..0000000 --- a/inst/templates/call-style-description.yml +++ /dev/null @@ -1,17 +0,0 @@ -# use usethis::use_tidy_description() to style DESCRIPTION file and open any -# changes as a pull request to the branch that started the workflow -name: call-style-description -# on specifies the build triggers. See more info at -# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows -on: -# workflow_dispatch allows for pushing a button to run the workflow manually -# push runs the workflow on branches listed in square brackets -# uncomment the following line to add manual capabilities - #workflow_dispatch: - push: - branches: [main, master] - paths: - - 'DESCRIPTION' -jobs: - call-workflow: - uses: nmfs-fish-tools/ghactions4r/.github/workflows/style-description.yml@main diff --git a/inst/templates/call-style.yml b/inst/templates/call-style.yml deleted file mode 100644 index 56e00ef..0000000 --- a/inst/templates/call-style.yml +++ /dev/null @@ -1,12 +0,0 @@ -# use styler::style_active_package() to style code and open any changes as a pull request to the branch that started the workflow -name: call-style -# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows -on: -# workflow_dispatch requires pushing a button to run the workflow manually. uncomment the following line to add: - #workflow_dispatch: - # Runs the workflow on each push to the main or master branch: - push: - branches: [main, master] -jobs: - call-workflow: - uses: nmfs-fish-tools/ghactions4r/.github/workflows/style-r-code.yml@main diff --git a/inst/templates/call-update-docs.yml b/inst/templates/call-update-docs.yml deleted file mode 100644 index e2d83de..0000000 --- a/inst/templates/call-update-docs.yml +++ /dev/null @@ -1,11 +0,0 @@ -# run devtools::document and open any changes as a pull request to the branch that started the workflow -name: call-update-docs -on: -# workflow_dispatch requires pushing a button to run the workflow manually. uncomment the following line to add: - #workflow_dispatch: - # Runs the workflow on each push to the main or master branch: - push: - branches: [main, master] -jobs: - call-workflow: - uses: nmfs-fish-tools/ghactions4r/.github/workflows/update-roxygen-docs.yml@main diff --git a/man/use_style_description.Rd b/man/use_style_description.Rd deleted file mode 100644 index 46f5953..0000000 --- a/man/use_style_description.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/use_r_workflows.R -\name{use_style_description} -\alias{use_style_description} -\title{use workflow in current pkg to run \code{usethis::use_tidy_description()}} -\usage{ -use_style_description(workflow_name = "call-style-description.yml") -} -\arguments{ -\item{workflow_name}{What to name the github action workflow locally. Must -have the file extension \code{.yml}} -} -\description{ -Run \code{usethis::use_tidy_description()} upon changes to the DESCRIPTION file -and submit results as a PR. -} diff --git a/man/use_style_r_code.Rd b/man/use_style_r_code.Rd deleted file mode 100644 index 01a83ec..0000000 --- a/man/use_style_r_code.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/use_r_workflows.R -\name{use_style_r_code} -\alias{use_style_r_code} -\title{use workflow in current pkg to run styler::style_pkg() and submit results as a PR} -\usage{ -use_style_r_code(workflow_name = "call-style.yml") -} -\arguments{ -\item{workflow_name}{What to name the github action workflow locally. Must -have the file extension \code{.yml}} -} -\description{ -use workflow in current pkg to run styler::style_pkg() and submit results as a PR -} diff --git a/man/use_update_roxygen_docs.Rd b/man/use_update_roxygen_docs.Rd deleted file mode 100644 index fe66774..0000000 --- a/man/use_update_roxygen_docs.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/use_r_workflows.R -\name{use_update_roxygen_docs} -\alias{use_update_roxygen_docs} -\title{use workflow in current pkg to run devtools::document() and submit results as a PR} -\usage{ -use_update_roxygen_docs(workflow_name = "call-update-docs.yml") -} -\arguments{ -\item{workflow_name}{What to name the github action workflow locally. Must -have the file extension \code{.yml}} -} -\description{ -use workflow in current pkg to run devtools::document() and submit results as a PR -} diff --git a/tests/testthat/test-use_r_workflows.R b/tests/testthat/test-use_r_workflows.R index 890dd0d..e64f3a8 100644 --- a/tests/testthat/test-use_r_workflows.R +++ b/tests/testthat/test-use_r_workflows.R @@ -151,20 +151,6 @@ test_that("use_build_pkgdown()) works", { expect_snapshot(test) }) -test_that("use_update_roxygen_docs() works", { - use_update_roxygen_docs() - expect_true(file.exists(".github/workflows/call-update-docs.yml")) - test <- readLines(".github/workflows/call-update-docs.yml") - expect_snapshot(test) -}) - -test_that("use_style_r_code() works", { - use_style_r_code() - expect_true(file.exists(".github/workflows/call-style.yml")) - test <- readLines(".github/workflows/call-style.yml") - expect_snapshot(test) -}) - test_that("use_build_deploy_bookdown() works", { use_build_deploy_bookdown() expect_true(file.exists(".github/workflows/call-build-deploy-bookdown.yml"))