Skip to content

Regenerate Paws

Regenerate Paws #597

Workflow file for this run

# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
issue_comment:
types: [created]
name: Commands
jobs:
document:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
name: document
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2
needs: pr-document
- name: Document
run: |
roxygen2::roxygenise(package.dir = 'paws.common')
shell: Rscript {0}
- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add man/\* NAMESPACE
git commit -m 'Document'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
style:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
name: style
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: r-lib/actions/setup-r@v2
- name: Install dependencies
run: install.packages("styler")
shell: Rscript {0}
- name: Style
run: |
styler::style_pkg(pkg = 'paws.common')
styler::style_pkg(pkg = 'make.paws')
shell: Rscript {0}
- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add \*.R
git commit -m 'Style'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/version') }}
name: version
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.event.comment.body }}
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: r-lib/actions/setup-r@v2
- name: Version
id: version
run: |
# extract make.paws::paws_update_version to reduce the need to install make.paws
paws_update_version <- function(dir) {
var <- Sys.getenv("VERSION")
m <- regexpr("[0-9\\.]+", var)
version <- gsub('[[:punct:] ]$',"", regmatches(var, m, invert = FALSE))
cat("pkg_version=", version, "\n", sep="", file = Sys.getenv("GITHUB_OUTPUT"))
packages <- list.files(dir, full.names = T)
descriptions <- file.path(packages, "DESCRIPTION")
if (length(version) == 0) return()
for (desc in descriptions) {
lines <- readLines(desc)
found <- grepl("Version: [0-9\\.]+", lines, perl = T)
lines[found] <- gsub("[0-9\\.]+", version, lines[found])
found <- grepl("paws\\..*[0-9]+\\.[0-9]+\\.[0-9]+", lines,
perl = T)
found[found] <- !grepl("paws\\.common.*[0-9]+\\.[0-9]+\\.[0-9]+",
lines[found], perl = T)
lines[found] <- gsub("[0-9]+\\.[0-9]+\\.[0-9]+", version,
lines[found])
writeLines(lines, desc)
}
}
paws_update_version("cran")
shell: Rscript {0}
- name: commit
if: ${{ steps.version.outputs.pkg_version != '' }}
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add cran/*
git commit -m 'Update Cran Version: ${{ steps.version.outputs.pkg_version }}'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}