Skip to contents

Pin a third-party action in a workflow

Usage

pin_action_workflow(
  action = "r-lib/actions/check-r-package@v2",
  replacement = NULL,
  workflow = ".github/workflows/R-CMD-check.yaml",
  write = FALSE
)

Arguments

action

the action written with github syntax that contains at least the github user, repo, and tag

replacement

(optional) the replacement for the particular action. If this is not provided (default), pin_action() will be used to find the replacement

workflow

the path to a github workflow file

write

if TRUE, the workflow file will be overwritten. Defaults to FALSE, which leaves the workflow file intact

Value

a character vector of the workflow file with the actions replaced.

Examples

pkgdown <- withr::local_tempdir()
fs::file_copy(system.file("workflows", "pkgdown.yaml", package = "pinsha"), pkgdown)
actions <- pin_find_actions(pkgdown)
actions
#> [1] "r-lib/actions/setup-pandoc@v2"              
#> [2] "r-lib/actions/setup-r@v2"                   
#> [3] "r-lib/actions/setup-r-dependencies@v2"      
#> [4] "JamesIves/github-pages-deploy-action@v4.5.0"
for (action in actions) pin_action_workflow(action, workflow = pkgdown, write = TRUE)
pin_find_actions(pkgdown)
#> [1] "r-lib/actions/setup-pandoc@bd49c52ffe281809afa6f0fecbf37483c5dd0b93 #v2.11.3"         
#> [2] "r-lib/actions/setup-r@bd49c52ffe281809afa6f0fecbf37483c5dd0b93 #v2.11.3"              
#> [3] "r-lib/actions/setup-r-dependencies@bd49c52ffe281809afa6f0fecbf37483c5dd0b93 #v2.11.3" 
#> [4] "JamesIves/github-pages-deploy-action@65b5dfd4f5bcd3a7403bbc2959c144256167464e #v4.5.0"