Skip to content

Update r-cmd-check.yml #49

Update r-cmd-check.yml

Update r-cmd-check.yml #49

Workflow file for this run

---
name: Spelling
on:
workflow_dispatch:
workflow_call:
inputs:
r-version:
description: 'The version of R to use'
default: '4.2'
required: false
type: string
push:
branches:
- main
- devel
- pre-release
pull_request:
branches:
- main
- devel
- pre-release
concurrency:
group: spelling-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
roxygen:
name: Spellcheck
runs-on: ubuntu-20.04
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
if: >
!contains(github.event.commits[0].message, '[skip spellcheck]')
steps:
##################### BEGIN boilerplate steps #####################
- name: Get branch names
id: branch-name
uses: tj-actions/[email protected]
- name: Checkout repo (PR) 🛎
uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout repository
uses: actions/checkout@v3
if: github.event_name != 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
- name: Normalize inputs
id: normalizer
run: |
R_VERSION="${{ inputs.r-version }}"
if [ "$R_VERSION" == "" ]
then {
R_VERSION="4.2"
}
fi
echo "::set-output name=R_VERSION::$R_VERSION"
shell: bash
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ steps.normalizer.outputs.R_VERSION }}
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.local/share/renv
~/.staged.dependencies
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: ${{ runner.os }}-renv-
- name: Install Dependencies
run: |
if (!requireNamespace("spelling", quietly = TRUE)) {
install.packages("spelling")
}
shell: Rscript {0}
- name: Run Spellcheck
run: |
(spell_errors <- spelling::spell_check_package())
if (nrow(spell_errors) > 0L) {
quit(save = "no", status = 1, runLast = FALSE)
}
shell: Rscript {0}