Skip to contents

Automatically pin all actions to their expected hashes in your GitHub workflows

Usage

pin(
  workflows = ".github/workflows",
  include_official = FALSE,
  write = FALSE,
  verbose = TRUE
)

Arguments

workflows

the directory to your github workflows

include_official

when TRUE, official github action workflows will also be pinned. Defaults to FALSE, meaning that the official workflows will continue to use tags

write

When TRUE, the workflows will be overwritten. Defaults to FALSE

verbose

when TRUE (default), write out progress for each file. Set to FALSE to suppress all but error messages

Value

nothing. Used for its side-effect

Examples

tmp <- withr::local_tempdir()
workflows <- fs::path(tmp, ".github", "workflows")
fs::dir_copy(system.file("workflows", package = "pinsha"), workflows)
withr::with_dir(tmp, pin_find_actions(".github/workflows"))
#> $`.github/workflows/R-CMD-check.yaml`
#> [1] "r-lib/actions/setup-pandoc@v2"        
#> [2] "r-lib/actions/setup-r@v2"             
#> [3] "r-lib/actions/setup-r-dependencies@v2"
#> [4] "r-lib/actions/check-r-package@v2"     
#> 
#> $`.github/workflows/pkgdown.yaml`
#> [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"
#> 
#> $`.github/workflows/test-coverage.yaml`
#> [1] "r-lib/actions/setup-r@v2"             
#> [2] "r-lib/actions/setup-r-dependencies@v2"
#> [3] "codecov/codecov-action@v5"            
#> 
withr::with_dir(tmp, pin(write = TRUE))
#>  Found 3 workflows: R-CMD-check.yaml, pkgdown.yaml, and test-coverage.yaml
#>  Modifying actions in ".github/workflows/R-CMD-check.yaml"
#>  Modifying actions in ".github/workflows/R-CMD-check.yaml" ... done
#> 
#>  Modifying actions in ".github/workflows/pkgdown.yaml"
#>  Modifying actions in ".github/workflows/pkgdown.yaml" ... done
#> 
#>  Modifying actions in ".github/workflows/test-coverage.yaml"
#>  Modifying actions in ".github/workflows/test-coverage.yaml" ... done
#> 
withr::with_dir(tmp, pin_find_actions(".github/workflows"))
#> $`.github/workflows/R-CMD-check.yaml`
#> [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] "r-lib/actions/check-r-package@bd49c52ffe281809afa6f0fecbf37483c5dd0b93 #v2.11.3"     
#> 
#> $`.github/workflows/pkgdown.yaml`
#> [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"
#> 
#> $`.github/workflows/test-coverage.yaml`
#> [1] "r-lib/actions/setup-r@bd49c52ffe281809afa6f0fecbf37483c5dd0b93 #v2.11.3"             
#> [2] "r-lib/actions/setup-r-dependencies@bd49c52ffe281809afa6f0fecbf37483c5dd0b93 #v2.11.3"
#> [3] "codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 #v5.4.0"             
#>