Automation with GitHub Actions

Hugo Gruson

March 2022

Why and what to automate?

What if xkcd was wrong?

  • Requires to be online & available when the task needs to run
  • Not reproducible
  • Mental load


Good for repetitive, menial tasks.

More time for watching movies focusing on more interesting tasks.

Benefits of GitHub Actions over alternatives

Most famous automation system: cron

GitHub Actions:

  • Scheduling system (and extra triggers) ← cron
  • Server to run code
  • Notification system

Automation code is open-source as well


name: GitHub Actions Demo
on: [push]
    runs-on: ubuntu-latest
      - run: echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
      - run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v2
      - run: echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
      - run: echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ github.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."

Syntax: re-using existing blocks

Syntax: re-using existing blocks

# Workflow derived from
# Need help debugging build failures? Start at
    branches: [main, master]
    branches: [main, master]

name: R-CMD-check

    runs-on: ubuntu-latest
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      R_KEEP_PKG_SOURCE: yes
      - uses: actions/checkout@v2

      - uses: r-lib/actions/setup-r@v2
          use-public-rspm: true

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

      - uses: r-lib/actions/check-r-package@v2


Over to you

  • Do you think you could benefit from using GitHub Actions?
  • What kind of task do you have to do on a regular basis?
  • How can I support you in using GitHub Actions?

Missing features

  • No way to centralize infrastructure / updates for organisations
  • Difficult to test locally. looks nice but I can’t get it to work for complex cases, where I need it the most

Final words

All automation needs to be done in the context of a reflection on our economic system.