GitHub Actions: What It Is
GitHub Actions is the automation built into GitHub. It runs a workflow each time code changes.
One picture
A push starts a workflow. The workflow runs jobs on runners.
push -> workflow -> job -> runnerThe workflow file
The file lives in a fixed folder in the repo.
.github/workflows/ci.ymlThe pieces
Each piece has one job to do.
workflow: the whole routine
job: one part, one runner
step: one commandExample
name: CI
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: npm testKey points
- GitHub Actions: automation that lives inside GitHub.
- A workflow is a file of automatic steps, stored with the code.
- A runner is a computer that GitHub provides for one job.
- Use GitHub Actions to test, build and ship code on every push.
- Workflows run on GitHub itself, so no extra server is needed.
- Jenkins is a separate tool that also runs pipelines, on your own server.
- GitLab CI is the built-in automation of GitLab, a different code host.
- GitHub Actions turns a push into checked, built and shipped code.
In this example, name gives the workflow its title. The on line says the workflow runs on a push. The job is called test. The runs-on line picks the runner. The step runs the tests. This is the shape of a workflow. The next section adds the steps that fetch the code.
Note
GitHub Actions is free for public repositories. Private ones have a usage limit.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
What is GitHub Actions?