initial draft of Pilot 3 completion blog post #489
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Check 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 | |
pull_request: | |
branches: | |
- main | |
- devel | |
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} |