# O que é um workflow do GitHub Actions? Jobs, steps e triggers

> Um workflow do GitHub Actions é um arquivo YAML que define quando e como seu CI roda. Entenda como eventos, jobs, steps e runners se encaixam.

Source: https://latchkey.dev/pt/learn/ci-cd-concepts/what-is-a-github-actions-workflow  
Updated: 2026-06-25

Um workflow é apenas um arquivo YAML em `.github/workflows/` que diz: quando este evento acontecer, execute estes jobs nestes runners.

O GitHub Actions automatiza CI/CD por meio de workflows - arquivos YAML declarativos que vinculam eventos ao trabalho que eles disparam. Entender os quatro substantivos (evento, job, step, runner) faz todo o modelo fazer sentido.

## Eventos disparam workflows

Um workflow declara os eventos que escuta em seu bloco `on:` - um push, um pull request, um agendamento ou um disparo manual. Quando um evento correspondente ocorre, o GitHub coloca o workflow na fila.

```Triggers
on:
  push:
    branches: [main]
  pull_request:
```

## Jobs rodam em runners

Um workflow contém um ou mais jobs. Cada job roda em um runner novo e, por padrão, os jobs rodam em paralelo. Use `needs:` para fazer um job esperar por outro, formando um grafo de dependências.

## Steps fazem o trabalho

Cada job é uma lista ordenada de steps. Um step ou executa um comando de shell (`run:`) ou invoca uma action reutilizável (`uses:`). Steps de um job compartilham o mesmo runner e sistema de arquivos, então steps anteriores preparam o estado para os posteriores.

```A minimal job
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm test
```

## Juntando tudo

Evento → workflow → jobs (em runners, possivelmente paralelos) → steps (em ordem). Todo o resto - matrix, cache, artifacts, permissões - se sobrepõe a essa forma central.

## FAQ

### What is What is a GitHub Actions Workflow? Jobs, Steps, and triggers?

GitHub Actions automates CI/CD through workflows - declarative YAML files that bind events to the work they trigger. Understanding the four nouns (event, job, step, runner) makes the whole model click.

### Events trigger workflows?

A workflow declares the events it listens for in its on: block - a push, a pull request, a schedule, or a manual dispatch. When a matching event fires, GitHub queues the workflow.

### Jobs run on runners?

A workflow contains one or more jobs. Each job runs on a fresh runner and, by default, jobs run in parallel. Use needs: to make one job wait for another, forming a dependency graph.

### Steps do the work?

Each job is an ordered list of steps. A step either runs a shell command (run:) or invokes a reusable action (uses:). Steps in a job share the same runner and filesystem, so earlier steps set up state for later ones.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
