Skip to content

How to set up and customize GitHub actions robots

Candace Savonen edited this page Feb 15, 2022 · 37 revisions

Customizing Automation

By default, all automation steps and checks will run. But depending on the needs of your course, you can turn these on and off by going to the config_automation.yml file and switching options to yes or no.

There are two main sets of automation steps and checks run. One set which is run upon opening a pull request .github/workflows/pull-request.yml and another that is run upon changes being merged to the main branch .github/workflows/render-all.yml.

Pull request checks:

These actions are triggered upon a pull request being opened. It's set up is in the file: .github/workflows/pull-request.yml/.

check-quizzes

check-quizzes: yes

Leanpub needs a particular format for it to upload correctly. This action will look for quizzes in a quizzes directory and check for these items. The outcome of these quiz checks will be printed to a GitHub comment on your pull request.

url-checker

url-checker: yes

GitHub actions runs a check on all the URLs upon creating a pull request to the main branch. If it fails, you'll need to go the Actions tab of this repository, then find the GitHub check_urls job for the last commit you just pushed. Click on check_urls and the specific step of Check URLs to see a print out of the URLs tested.

If the URL checker is failing on something that isn't really a URL or doesn't need to be checked, open up the pull-request.yml, scroll down to the url-check step add the imposter URL on to the exclude-urls: argument with a comma in between.

render-preview

render-preview: yes

After you open a pull request, a preview of the renders as they will appear after the pull request is accepted is run and linked to in a comment on the pull request. Upon each commit these previews will re-render and edit the comment with the latest render. These Github Actions are located in render-preview section of the pull-request.yml. These previews do NOT incorporate any changes influenced by any changes to the Docker image if the Dockerfile is also updated in the same pull request.

spell-check: yes

Github actions will automatically run a spell check on all Rmd's and md's whenever a pull request to the main branch is filed. Depending on your preference, you may find it easier to spell check manually on your local computer before pushing to Github.

It will fail if there are more than 2 spelling errors and you'll need to resolve those before being able to merge your pull request. Errors will be printed out on a GitHub comment on your pull request.

To resolve those spelling errors, go to this repository's Actions tab. Then, click on the GitHub action from the PR you just submitted. Scroll all the way down to Artifacts and click spell-check-results. This will download a zip file with a TSV that lists all the spelling errors.

Some of these errors may be things that the spell check doesn't recognize for example: ITCR or DaSL. If it's a 'word' the spell check should recognize, you'll need to add this to the dictionary.

Go to the resources/dictionary.txt file. Open the file and add the new 'word' to its appropriate place (the words are in alphabetical order). Then commit the changes to resources/dictionary.txt to your branch and this should make the spell check status check pass.

style-code: yes

The styler package to all style R in all Rmds. Style changes will automatically be committed back to your branch.

docker-test: no

This is only relevant if you have your own Docker image you are managing for your course. If changes are made to Docker-relevant files: Dockerfile, install_github.R, or github_package_list.tsv, this will test re-build the Docker image. If it is successfully built, then it makes sense to merge it to main but the docker image will not be pushed to Dockerhub automatically. Follow these instructions to push your Docker image to Dockerhub.

Rendering actions

Upon merging changes to any Rmd or assets/ folder to main, the course material will be automatically re-rendered.

render-bookdown: yes
render-leanpub: yes
render-coursera: yes

For publishing to Leanpub, make sure that the render Leanpub option is set to yes: render-leanpub: yes. See more details about publishing to Leanpub, here.

For publishing to Coursera, make sure render Coursera option is set to yes: render-coursera: yes. See more details about publishing to Coursera, here.

Clone this wiki locally