GitHub Actions is a way to run code on somebody else's computer. You can run code on a scheduled basis or when specific actions occur (the most common event is when you push your changes to GitHub. A few examples:
- Checking an R package on every commit: action, output
- Checking a Python package on every commit: action, output
- Render a website: action, output
- Run a script on a scheduled basis: action
GitHub Actions are YAML files that live in the ".github/workflows" directory of a GitHub repository. To practice, make a fork of this repository and then open up the ".github/workflows/hello-world-action.yaml" file. The file looks like this:
I'll describe the steps from the bottom up.
- The action produces a pdf document (demo.pdf) from an RMarkdown file (demo.Rmd). This pdf output is made availabe by the "upload artifact" step as a clickable link in the build log.
- The document is rendered using
rmarkdown::render()
. - Before the document is rendered, the actions needs to install R, install the ability to produce PDF output, and install R packages it needs.
Since you've just forked the repository, the action hasn't run for you yet. Update the author name in the document from "Dewey Dunnington" to your own name. You can do this by clicking the "edit" link at the top (no need to clone into your local computer if you don't want to!).
Click "commit changes" at the bottom and wait for your action to complete.
When the action has completed, open the "demo.pdf" artifact to view your results!
A few links to official and unofficial guides: