use_github_action: Add a GitHub Actions CI Workflow

View source: R/use.R

use_github_actionR Documentation

Add a GitHub Actions CI Workflow

Description

Writes '.github/workflows/ci.yaml' using the r-ci template (Ubuntu and macOS, via 'eddelbuettel/github-actions/r-ci@master'). Adds '^\.github$' to '.Rbuildignore' if not already present.

Usage

use_github_action(path)

Arguments

path

Path to package root directory. Required; no default is provided because this function writes files under 'path', and CRAN Repository Policy forbids defaulting write paths to the user's home filespace (which includes 'getwd()').

Value

Path to the created YAML file (invisibly).

Examples

# Scaffold a throwaway package in tempdir() and add the workflow.
pkg <- file.path(tempdir(), "ghapkg_example")
dir.create(pkg, showWarnings = FALSE)
writeLines(c(
  "Package: ghapkg",
  "Title: Example",
  "Version: 0.0.1",
  "Authors@R: person('A', 'B', email = 'a@b.com', role = c('aut','cre'))",
  "Description: Example.",
  "License: GPL-3"
), file.path(pkg, "DESCRIPTION"))

yaml <- use_github_action(path = pkg)
file.exists(yaml)

unlink(pkg, recursive = TRUE)

tinypkgr documentation built on April 22, 2026, 9:07 a.m.