Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

Hoofdstuk 1Naam in de cursus: Understanding GitHub Actions

Write your first workflow

GitHub Actions runs automation in your repository: a workflow (a YAML file in .github/workflows/) starts on an event, runs jobs on runners, and every job runs steps — shell commands or ready actions.

  • 5 Lessen
  • 3 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

1.1

Know the building blocks

Event → workflow → jobs → steps.

PartMeaning
WorkflowA YAML file in .github/workflows/
EventWhat starts it: push, pull request, schedule, manual
JobA group of steps on one runner; jobs run in parallel by default
StepOne shell command (run) or one action (uses)
RunnerThe machine: GitHub-hosted (ubuntu-latest, windows-latest, macos-latest) or self-hosted
ActionA reusable step from the Marketplace or your own repository

1.2

Write a workflow

The smallest useful workflow: on every push, check out the code and run a test.

.github/workflows/ci.yml
name: CI
on:
  push:
    branches: [main]
  pull_request:
 
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Check out the code
        uses: actions/checkout@v4
      - name: Show the tools
        run: |
          uname -a
          python3 --version
      - name: Run the tests
        run: ./scripts/test.sh
mkdir -p .github/workflows
git add .github/workflows/ci.yml
git commit -m "Add CI workflow"
git push
gh run list
gh run watch
gh run view --log-failed

Onthoud

Indentation is part of YAML. Use spaces, never tabs. A wrong indent is the most common error.

1.3

Chain jobs

Jobs run in parallel. needs makes a job wait for others — build, then test, then deploy.

.github/workflows/pipeline.yml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make build
  test:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make test
  deploy:
    needs: [build, test]
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - run: echo "deploy"

1.4

Choose a runner

GitHub-hosted runners are new, clean VMs for every job. Self-hosted runners are your own machines — for private networks or special hardware.

RunnerGoodWatch out
GitHub-hostedClean every time, no maintenanceMinutes limits on private repos
Self-hostedReach private networks, own tools, no minute costYou patch and secure them; never use them for public repos
Larger runnersMore CPU/RAM, static IPsCost

1.5

Read the results

Every run shows its jobs and the log of every step in the Actions tab, and as checks on the commit or pull request.

  • A red X on a pull request = a failed check; click Details for the log.
  • Re-run failed jobs after a flaky failure.
  • Add a badge to the README: ![CI](https://github.com/OWNER/REPO/actions/workflows/ci.yml/badge.svg).

Alle commando's in dit hoofdstuk