32  Case study: a simplified version of the R check-release.yaml workflow

on: [push, pull_request]

name: R-CMD-check

jobs:
  R-CMD-check:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout files from GitHub version control repository
        uses: actions/checkout@v2

      - name: Setup R
        uses: r-lib/actions/setup-r@v2

      - name: Install R packages
        uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: any::rcmdcheck
          needs: check

      - name: Checks if R package can be installed
        uses: r-lib/actions/check-r-package@v2
Exercise

Orientating ourselves with the check-release.yaml workflow

Let’s answer the following questions to start better understanding the check-release.yaml workflow.

  1. How many jobs are there?

  2. How many steps are there?

  3. What which steps are actions and which are commands

  4. What is the type of runner

  5. What events trigger this workflow?

Exercise

Adding the check-release.yaml workflow to your R package repository

There are two ways you can do this. Manually via the GitHub interface:

  1. Go to the actions tab for your GitHub repository

  2. Click on “set up a workflow yourself

  3. Delete the template action provided to you, and paste the check-release.yaml file above into the text editor. Rename the file check-release.yaml.

  4. Click “Start commit”, enter a commit message and then click “Commit”.

Or using the usethis::use_github_action package convenience function:

  1. In the R console run usethis::use_github_action("check-release")

  2. Put the new check-release.yaml file in .github/workflows under local version control and push the commit to GitHub.