Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Setup GitHub Actions manually

You can do this via the web interface of GitHub or you can clone the project locally, do it there and then push the changes to GitHub.

  • Create a folder in the root of your repository called .github/workflows.
  • Create a YAML file in it.
    • The name of the file does not matter.
    • The extension must be either .yaml or .yml.
    • I often call it .github/workflows/ci.yaml.
    • For content see bellow.
  • Commit the changes.
  • If you worked locally on your computer then push the changes to GitHub.
  • Once you did this visit the Actions tab of your repository on GitHub. After a few seconds you should see the indication that a job is running and then after a while you will see the results.
# We need a trigger
on:
  # This will run the workflow on every push
  push:
  # One trigger is enough.
  # We added this so we can run the workflow manually as well without making changes.
  workflow_dispatch:

# We need at least on job
jobs:
  # The name of the job can be any arbitrary name. In this it will be "ci"
  ci:
    # We have to state which platform to run on:
    runs-on: ubuntu-latest
    # We need one or more steps:
    steps:
      # The first and only step is executing a shell command to print Hello World
      - run: echo Hello World

# We don't need any of the comments...

repository


  • Next we’ll see examples for these YAML files.