(GH newb attempting to cargo cult my way through some configuration ...)
I am using the GitHub actions YAML file here to test an R package. By default this workflow tests on four separate platforms, but this is overkill for my day-to-day needs. (This action does more limited testing, but I think? it also misses some stuff I wanted from the fuller workflow ...)
I would like to have the tests done on all four platforms only if the commit message includes the string "full check", otherwise testing just one platform. I know I can in principle achieve something like this if I include a conditional:
if: "contains(github.event.head_commit.message, '[full ci]')"
but I'm not sure of the precise syntax for including it in the workflow (and I'm afraid of spending many hours on trial-and-error attempts)
The chunk of the workflow that defines the set of platforms current looks like this, with three of the platforms commented out:
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
## - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
## - {os: windows-latest, r: 'release'}
## - {os: macOS-latest, r: 'release'}
I'm assuming that just sticking the if:
clause below the first row won't work (because it would break up the list). I suppose something like this might work?
matrix:
config:
if: "! contains(github.event.head_commit.message, '[full ci]')"]
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
if: "contains(...)"
config:
[list with all four configs]
(Does this syntax have an if/else
construct?)
I'm looking for answers that help me achieve the narrow goal, and hopefully understand the YAML syntax a little better (I have tried to read the FM ...)