Create workflow that calls an rworkflows GitHub Actions (GHA)

use_workflow(
  template = "rworkflows",
  name = template,
  tag = "@master",
  on = c("push", "pull_request"),
  branches = c("master", "main", "devel", "RELEASE_**"),
  runners = construct_runners(),
  github_token = "${{ secrets.GITHUB_TOKEN }}",
  cache_version = "cache-v1",
  enable_act = FALSE,
  run_bioccheck = FALSE,
  run_rcmdcheck = TRUE,
  as_cran = TRUE,
  run_vignettes = TRUE,
  has_testthat = TRUE,
  has_runit = FALSE,
  run_covr = TRUE,
  has_latex = FALSE,
  tinytex_installer = "TinyTeX-1",
  tinytex_version = NULL,
  pandoc_version = "2.19",
  run_pkgdown = TRUE,
  run_docker = FALSE,
  docker_registry = "ghcr.io",
  docker_user = NULL,
  docker_org = docker_user,
  docker_token = "${{ secrets.DOCKER_TOKEN }}",
  miniforge_variant = FALSE,
  miniforge_version = NULL,
  activate_environment = "test",
  environment_file = NULL,
  channels = NULL,
  save_dir = here::here(".github", "workflows"),
  return_path = TRUE,
  force_new = FALSE,
  preview = FALSE,
  verbose = TRUE
)

Arguments

template

Workflow template name.

"rworkflows"

A short workflow script that calls the GitHub action from the GitHub Marketplace. The action is continually updated so users do not need to worry about maintaining it.

"rworkflows_static"

A longer workflow scripts that explicitly copies all steps from the rworkflows action into a static file. Users may need to update this file themselves over time, though this does allow for a fully customisable workflow.

Optionally, you can include the suffix ":<branch>" to specify which branch you would like to download the "action.yml" file from to create the static workflow template.
name

An arbitrary name to call the workflow.

tag

Which version of the rworkflows action to use. Can be a branch name on the GitHub repository (e.g. "\@master"), or a Release Tag (e.g. "\@v1").

on

GitHub trigger conditions.

branches

GitHub trigger branches.

runners

Runner configurations for multiple Operating Systems (OS), including R versions, Bioc versions, and container sources. Can use the construct_runners functions to assist in constructing customized runners configurations.

github_token

GitHub authentication token with permissions to push to the R package's GitHub repository. Also used to bypass GitHub download limits. By default, uses {{ secrets.GITHUB_TOKEN }} which is automatically set up by GitHub. However users can also choose to pass a custom GitHub secret variable (e.g. {{ secrets.PAT_GITHUB }}) which allows access to private repositories. Read here for more details.

cache_version

Name of the cache sudirectory to be used when reinstalling software in GHA.

enable_act

Whether to add extra lines to the yaml to enable local workflow checking with act.

run_bioccheck

Run Bioconductor checks using BiocCheck::BiocCheck(). Must pass in order to continue workflow.

run_rcmdcheck

Run R CMD checks using rcmdcheck::rcmdcheck(). Must pass in order to continue workflow.

as_cran

When running R CMD checks, use the '–as-cran' flag to apply CRAN standards

run_vignettes

Build and check R package vignettes.

has_testthat

Run unit tests and report results.

has_runit

Run R Unit tests.

run_covr

Run code coverage tests and publish results to codecov.

has_latex

Install a suite of LaTeX dependencies used for rendering Sweave (.rnw) and other documentation files.

tinytex_installer

Which release of tinytex (bundles of LaTeX packages) to use. All options can be found here. Note, 'TinyTeX-2' is only available for tinytex_version='daily'.

tinytex_version

Which version of tinytex to use. When set to ”, uses the latest daily build. All versions can be found here.

pandoc_version

Which version of pandoc to use. For details see here.

run_pkgdown

Knit the README.Rmd (if available), build documentation website, and deploy to gh-pages branch.

run_docker

Whether to build and push a Docker container to DockerHub.

docker_registry

Docker container registry to push to. Options include:

"ghcr.io" :

GitHub Container Registry

"docker.io" :

DockerHub

docker_user

Docker registry username. Not used when docker_registry="ghcr.io".

docker_org

Docker registry organization name. Is the same as docker_user by default. Not used when docker_registry="ghcr.io".

docker_token

Docker registry token. Not used when docker_registry="ghcr.io".

miniforge_variant

If provided, this variant of Miniforge will be downloaded and installed. If miniforge_variant=false, Miniforge will not be installed at all. If miniforge_variant="", the "Miniforge3" variant will be installed. If miniforge_version is not provided, the latest version will be used. Currently-known values: - "Miniforge3" (default) - "Miniforge-pypy3" - "Mambaforge" - "Mambaforge-pypy3". Visit https://github.com/conda-forge/miniforge/releases/ for more information on available variants.

miniforge_version

If provided, this version of the given Miniforge variant will be downloaded and installed. If miniforge_variant is not provided, "Miniforge3" will be used. Visit https://github.com/conda-forge/miniforge/releases/ for more information on available versions.

activate_environment

Environment name (or path) to activate on all shells. Default is "test" which will be created in $CONDA/envs/test. If an empty string is used, no environment is activated by default (For "base" activation see the auto-activate-base option). If the environment does not exist, it will be created and activated. If environment-file is used and you want that to be the environment used, you need to explicitly provide the name of that environment on activate-environment. If using sh/bash/cmd.exe shells please read the IMPORTANT! section on the README.md! to properly activate conda environments on these shells.

environment_file

Path or URL to a .yml file to build the conda environment with. For more information see here.

channels

Conda configuration. Comma separated list of channels to use in order of priority. See here for more information.

save_dir

Directory to save workflow to.

return_path

Return the path to the saved yaml workflow file (default: TRUE), or return the yaml object directly.

force_new

If the GHA workflow yaml already exists, overwrite with new one (default: FALSE).

preview

Print the yaml file to the R console.

verbose

Print messages.

Value

Path or yaml object.

Examples

path <- use_workflow(save_dir = file.path(tempdir(),".github","workflows"))
#> Saving yaml ==> /tmp/RtmppaN4bb/.github/workflows/rworkflows.yml