CodeBlanks Logo Icon CodeBlanks

GitHub Actions

Learn CI with GitHub Actions.

What is GitHub Actions?

GitHub Actions is the continuous integration (CI) service built into GitHub. You drop YAML files into .github/workflows/; each file is a workflow. When an event triggers (for example push) the workflow runs.

A workflow holds one or more jobs; each job is a sequence of steps. In steps you run commands or call ready-made actions (uses:). A typical React Native flow: install dependencies, run tests, build with EAS. This flow runs automatically on every commit.

Practice Write the workflow skeleton

Write a workflow YAML file. The root holds name and on fields. Under on add a push event and a branches list.

Starter code

App.js
# add the workflow name and trigger here

Sample solution

App.js
name: CI
on:
  push:
    branches:
      - main

job and steps

A job is a sequence of steps running on one machine. You pick the OS with runs-on; ubuntu-latest is common for React Native. Each step either runs a command (run:) or calls an action (uses:).

Example: uses: actions/checkout@v4 pulls the repo; run: npm ci installs dependencies. Steps run in order; if one fails the job stops. Job names must be unique; each job can run on its own machine in parallel.

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What does runs-on pick?

App.js
jobs:
  build:
    runs-on: ?
  • The branch name
  • The version number
  • The OS Correct answer
  • The package name

Explanation: runs-on picks the OS where the job runs.

2 Call the checkout action

Question
    - uses: actions/____@v4
Answer
    - uses: actions/checkout@v4

Explanation: actions/checkout pulls the repository.

3 Match each step key to its role

Term Meaning
uses: Calls an action
run: Runs a command
runs-on: Operating system
needs: Job dependency

All lessons in Advanced