Github actions with R
Chapter 1 Introduction
1.1 What are GitHub Actions?
GitHub actions allow us to trigger automated steps after we launch GitHub interactions such as when we push, pull, submit a pull request, or write an issue.
For example, there are actions that will automatically trigger:
- continuous integration (CI)
- messages in response to issues or pull requests
- rendering/compiling e.g. of rmarkdown, bookdown, blogdowns etc
GitHub actions follow the steps designated in a
yaml file, which we place in the
.github/workflows folder of the repo.
We can add these
yaml files to our repo either by clicking on a series of steps on GitHub.com, or using wrapper functions provided by the
usethis package, depending on which actions you which to include.
We describe both ways here.
1.1.1 Usethis Wrappers
Two specific GitHub actions related to continuous integration can be implemented with either of the following:
More details are in chapter 2.
There are a range of other R actions available in the r-lib library.
You can add these example
yaml files using the following function (demonstrated here with the check-release action):
1.1.2 Marketplace Actions
There are a huge selection of other actions that you can choose from in the Marketplace that automate not only GitHub processes but also programming-language-specific options. To implement these, go to any repo you own and you will find “Actions” on the top menu. Click on “New Workflow” and pick one from the templates provided.
In some cases the
yaml will need to be modified. More detail on understanding the
yaml files can be found in chapter 4.
We experimented with setting up continuous integration with a reproducible environment using
renv in chapter 5.