Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
^data-raw$
^_beekeeper_rapid\.rds$
^_beekeeper\.yml$
^\.positai$
^\.claude$
^[.]?air[.]toml$
^\.vscode$
36 changes: 14 additions & 22 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,40 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check.yaml

permissions: read-all
name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
container: ${{ matrix.config.container }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
# - {os: macos-latest, r: 'release'}
# - {os: windows-latest, r: 'release'}
# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release', container: 'ghcr.io/api2r/pkgskills-ci:devel'}
- {os: ubuntu-latest, r: 'release', container: 'ghcr.io/api2r/pkgskills-ci:release'}
# - {os: ubuntu-latest, r: 'oldrel-1', container: 'ghcr.io/api2r/pkgskills-ci:oldrel-1'}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2
- uses: actions/checkout@v6

- uses: r-lib/actions/setup-r@v2
- uses: api2r/actions/install@v1
with:
use-container: "${{ matrix.config.container != '' }}"
token: ${{ secrets.GITHUB_TOKEN }}
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
extra-packages: any::rcmdcheck
cache-version: "1"

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
46 changes: 46 additions & 0 deletions .github/workflows/format-suggest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Workflow derived from https://github.com/posit-dev/setup-air/tree/main/examples

on:
# Using `pull_request_target` over `pull_request` for elevated `GITHUB_TOKEN`
# privileges, otherwise we can't set `pull-requests: write` when the pull
# request comes from a fork, which is our main use case (external contributors).
#
# `pull_request_target` runs in the context of the target branch (`main`, usually),
# rather than in the context of the pull request like `pull_request` does. Due
# to this, we must explicitly checkout `ref: ${{ github.event.pull_request.head.sha }}`.
# This is typically frowned upon by GitHub, as it exposes you to potentially running
# untrusted code in a context where you have elevated privileges, but they explicitly
# call out the use case of reformatting and committing back / commenting on the PR
# as a situation that should be safe (because we aren't actually running the untrusted
# code, we are just treating it as passive data).
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
pull_request_target:

name: format-suggest.yaml

jobs:
format-suggest:
name: format-suggest
runs-on: ubuntu-latest

permissions:
# Required to push suggestion comments to the PR
pull-requests: write

steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install
uses: posit-dev/setup-air@v1

- name: Format
run: air format .

- name: Suggest
uses: reviewdog/action-suggester@v1
with:
level: error
fail_level: error
tool_name: air
33 changes: 33 additions & 0 deletions .github/workflows/pkgdown-cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow removes the pkgdown preview directory when a PR is closed.
name: Clean up pkgdown preview

on:
pull_request:
types: [closed]

permissions:
contents: write

jobs:
clean-pr-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v6
with:
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
ref: gh-pages

- name: Remove PR preview directory
run: |
pr_dir="pr/${{ github.event.number }}"
if [ -d "$pr_dir" ]; then
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git rm -rf "$pr_dir"
git commit -m "Remove preview for PR #${{ github.event.number }}"
git push
else
echo "Directory $pr_dir does not exist, skipping cleanup."
fi
53 changes: 38 additions & 15 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,70 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all
name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
container:
image: ghcr.io/api2r/pkgskills-ci:release
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: actions/checkout@v6

- uses: r-lib/actions/setup-r-dependencies@v2
- uses: api2r/actions/install@v1
with:
extra-packages: any::pkgdown, local::.
use-container: "true"
token: ${{ secrets.GITHUB_TOKEN }}
needs: website
extra-packages: any::pkgdown gilead-biostats/qcthat local::. any::glue

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy PR preview 🧪
if: github.event_name == 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.8.0
with:
clean: false
branch: gh-pages
folder: docs
target-folder: pr/${{ github.event.number }}

- name: Comment with PR site URL 🌐
if: github.event_name == 'pull_request'
run: |
intPRNumber <- ${{ github.event.pull_request.number }}
strOwner <- tolower(qcthat::GetGHOwner())
strRepo <- qcthat::GetGHRepo()
strURL <- glue::glue(
"https://{strOwner}.github.io/{strRepo}/pr/{intPRNumber}/dev"
)
print(paste("🌐 URL:", strURL))
qcthat::CommentIssue(
intPRNumber,
glue::glue("🌐 [PR pkgdown deployed]({strURL})"),
NULL
)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
uses: JamesIves/github-pages-deploy-action@v4.8.0
with:
clean: false
branch: gh-pages
Expand Down
56 changes: 8 additions & 48 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,30 @@ on:
issue_comment:
types: [created]

name: pr-commands.yaml

permissions: read-all
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 }}
container:
image: ghcr.io/api2r/pkgskills-ci:release
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- 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
- uses: api2r/actions/install@v1
with:
extra-packages: any::roxygen2
use-container: "true"
token: ${{ secrets.GITHUB_TOKEN }}
needs: pr-document
extra-packages: any::roxygen2

- name: Document
run: roxygen2::roxygenise()
Expand All @@ -47,39 +43,3 @@ jobs:
- 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 }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- 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()
shell: Rscript {0}

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add \*.R
git commit -m 'Style'

- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading