From agent-almanac
Configures GitHub Actions CI/CD for R packages: multi-platform R CMD check, test coverage, and pkgdown site deployment using r-lib/actions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agent-almanac:setup-github-actions-ciThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Configure automated R CMD check, test coverage, and documentation deployment via GitHub Actions.
Configure automated R CMD check, test coverage, and documentation deployment via GitHub Actions.
Create .github/workflows/R-CMD-check.yaml:
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: R-CMD-check
permissions: read-all
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
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
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
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
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual", "--compact-vignettes=gs+qpdf")'
Expected: Workflow file .github/workflows/R-CMD-check.yaml created with a multi-platform matrix (macOS, Windows, Ubuntu) covering release, devel, and oldrel.
On failure: If the .github/workflows/ directory does not exist, create it with mkdir -p .github/workflows. Verify YAML syntax with a YAML linter.
Create .github/workflows/test-coverage.yaml:
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: test-coverage
permissions: read-all
jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage
- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
token: ${{ secrets.CODECOV_TOKEN }}
Expected: Workflow file .github/workflows/test-coverage.yaml created. Coverage reports will be uploaded to Codecov on each push and PR.
On failure: If Codecov upload fails, verify the CODECOV_TOKEN secret is set in the repository settings. For public repos, the token may be optional.
Create .github/workflows/pkgdown.yaml:
on:
push:
branches: [main, master]
release:
types: [published]
workflow_dispatch:
name: pkgdown
permissions:
contents: write
pages: write
jobs:
pkgdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
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: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}
- name: Deploy to GitHub pages
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
branch: gh-pages
folder: docs
Expected: Workflow file .github/workflows/pkgdown.yaml created. Site builds and deploys to gh-pages branch on push to main or release.
On failure: If deployment fails, ensure the repository has contents: write permissions enabled. Verify _pkgdown.yml has development: mode: release set.
Add to README.md:
[](https://github.com/USERNAME/REPO/actions/workflows/R-CMD-check.yaml)
Expected: README displays a live CI status badge that updates automatically after each workflow run.
On failure: If the badge shows "no status," verify the workflow filename in the badge URL matches the actual file. Push a commit to trigger the first workflow run.
gh-pages branch if using pkgdownCODECOV_TOKEN secret if using coverage reportingGITHUB_TOKEN has appropriate permissionsExpected: GitHub Pages is configured for pkgdown deployment. Required secrets are set. Token permissions are sufficient for the workflows.
On failure: If Pages deployment fails, check Settings > Pages to ensure the source is set to the gh-pages branch. If secrets are missing, add them under Settings > Secrets and variables > Actions.
git add .github/
git commit -m "Add GitHub Actions CI workflows"
git push
Check the Actions tab on GitHub to verify workflows run successfully.
Expected: Green checkmarks on all jobs in the GitHub Actions tab. Workflows trigger on both push and PR events.
On failure: Check workflow logs in the Actions tab. Common issues: missing system dependencies (add to extra-packages), vignette build failures (ensure pandoc setup step is present), YAML syntax errors.
permissions: GitHub Actions now requires explicit permissions. Add permissions: read-all at minimumr-lib/actions/setup-r-dependencies which handles most casesr-lib/actions/setup-pandoc@v2_pkgdown.yml has development: mode: release for GitHub Pagesr-lib/actions/setup-r-dependencies handles caching automaticallycreate-r-package - initial package setup including CI workflowbuild-pkgdown-site - detailed pkgdown configurationsubmit-to-cran - CI checks should mirror CRAN expectationsrelease-package-version - trigger deployment on releasenpx claudepluginhub pjt222/agent-almanacBuild and deploy a pkgdown documentation site for an R package to GitHub Pages. Covers _pkgdown.yml configuration, theming, article organization, reference index customization, and deployment methods. Use when creating a documentation site for a new or existing package, customizing layout or navigation, fixing 404 errors on a deployed site, or migrating between branch-based and GitHub Actions deployment methods.
Configures GitHub Actions CI/CD workflows for Python (pytest/ruff/mypy), Rust, and TypeScript (Jest/ESLint) projects with testing, linting, type-checking, build, and deployment pipelines.
Checks and configures GitHub Actions CI/CD workflows for container builds, tests, and releases. Updates action versions, adds caching, multi-platform builds, and audits missing workflows.