Die folgenden Tabellen bieten einen kompakten Überblick über die wichtigsten Syntax-Elemente der GitHub Actions Workflow-Definition. Sie dienen als Schnellreferenz für die tägliche Arbeit und ergänzen die detaillierten Kapitel der Dokumentation.
| Event | Beschreibung | Wichtige Activity Types | Filter |
|---|---|---|---|
push |
Push zu Branch/Tag | - | branches, tags, paths |
pull_request |
PR opened/updated/closed | opened, synchronize,
reopened, closed |
branches, paths |
pull_request_target |
PR von Fork (base context) | opened, synchronize,
reopened |
branches |
workflow_dispatch |
Manueller Trigger via UI/API | - | inputs |
schedule |
Cron-basiert | - | - |
workflow_call |
Als reusable Workflow | - | inputs, secrets |
workflow_run |
Nach anderem Workflow | completed, requested |
branches |
issues |
Issue-Events | opened, edited, deleted,
labeled |
- |
issue_comment |
Kommentar auf Issue/PR | created, edited, deleted |
- |
release |
Release-Events | published, created, edited,
deleted |
- |
repository_dispatch |
Custom Webhook-Event | - | - |
| Schlüssel | Typ | Beschreibung | Beispiel |
|---|---|---|---|
runs-on |
String/Array | Runner-Typ oder Label | ubuntu-latest, [self-hosted, linux] |
needs |
String/Array | Job-Dependencies | [build, test] |
if |
Expression | Conditional Execution | github.ref == 'refs/heads/main' |
environment |
String/Object | Deployment-Environment | production oder
{name: prod, url: ...} |
concurrency |
Object | Concurrency-Gruppe | {group: prod, cancel-in-progress: true} |
timeout-minutes |
Integer | Job-Timeout (max 360) | 30 |
strategy.matrix |
Object | Matrix-Definition | {os: [ubuntu, windows], node: [16, 18]} |
strategy.fail-fast |
Boolean | Stop bei erstem Failure | true (default) |
strategy.max-parallel |
Integer | Parallele Jobs begrenzen | 3 |
continue-on-error |
Boolean | Workflow bei Failure fortsetzen | false (default) |
permissions |
Object | GITHUB_TOKEN Permissions | {contents: read, issues: write} |
outputs |
Object | Job-Outputs definieren | {result: ${{ steps.test.outputs.result }}} |
container |
String/Object | Job in Container ausführen | node:18 |
services |
Object | Service-Container | {postgres: {image: postgres:13}} |
| Schlüssel | Typ | Beschreibung | Beispiel |
|---|---|---|---|
id |
String | Step-Identifier für Referenzen | build-step |
name |
String | Anzeigename in UI | Build application |
uses |
String | Action referenzieren | actions/checkout@v4 |
run |
String | Shell-Command ausführen | npm install |
with |
Object | Inputs für Action | {node-version: '18'} |
env |
Object | Environment-Variablen | {NODE_ENV: production} |
if |
Expression | Conditional Execution | success() |
continue-on-error |
Boolean | Step-Failure ignorieren | false (default) |
timeout-minutes |
Integer | Step-Timeout | 10 |
shell |
String | Shell-Typ | bash, pwsh, python |
working-directory |
String | Working Directory | ./src |
| Permission | Read | Write | Beschreibung |
|---|---|---|---|
actions |
✓ | ✓ | Workflows canceln, Artifacts verwalten |
checks |
✓ | ✓ | Check Runs erstellen/updaten |
contents |
✓ | ✓ | Repository-Content lesen/schreiben, Releases |
deployments |
✓ | ✓ | Deployments erstellen |
discussions |
✓ | ✓ | Discussions verwalten |
issues |
✓ | ✓ | Issues erstellen/kommentieren/labeln |
packages |
✓ | ✓ | GitHub Packages publizieren |
pages |
✓ | ✓ | GitHub Pages Builds |
pull-requests |
✓ | ✓ | PRs erstellen/kommentieren/reviewen |
security-events |
✓ | ✓ | Code Scanning Alerts |
statuses |
✓ | ✓ | Commit Status setzen |
id-token |
- | ✓ | OIDC Token für Cloud-Auth |
attestations |
✓ | ✓ | Artifact Attestations |
Default-Einstellungen:
permissions: {} = alle Permissions auf
noneread-all oder
restricted (nur contents/packages read)| Label | OS | CPU | RAM | Disk | Architektur |
|---|---|---|---|---|---|
ubuntu-slim |
Ubuntu | 1 | 5 GB | 14 GB | x64 |
ubuntu-latest |
Ubuntu 24.04 | 4 | 16 GB | 14 GB | x64 |
ubuntu-24.04 |
Ubuntu 24.04 | 4 | 16 GB | 14 GB | x64 |
ubuntu-22.04 |
Ubuntu 22.04 | 4 | 16 GB | 14 GB | x64 |
ubuntu-24.04-arm |
Ubuntu 24.04 | 4 | 16 GB | 14 GB | arm64 |
windows-latest |
Windows Server 2025 | 4 | 16 GB | 14 GB | x64 |
windows-2025 |
Windows Server 2025 | 4 | 16 GB | 14 GB | x64 |
windows-2022 |
Windows Server 2022 | 4 | 16 GB | 14 GB | x64 |
windows-11-arm |
Windows 11 | 4 | 16 GB | 14 GB | arm64 |
macos-latest |
macOS 15 | 3 (M1) | 7 GB | 14 GB | arm64 |
macos-15 |
macOS 15 | 3 (M1) | 7 GB | 14 GB | arm64 |
macos-14 |
macOS 14 | 3 (M1) | 7 GB | 14 GB | arm64 |
macos-13 |
macOS 13 | 4 | 14 GB | 14 GB | Intel x64 |
| Label | OS | CPU | RAM | Multiplier |
|---|---|---|---|---|
ubuntu-* |
Ubuntu | 2 | 7 GB | 1x |
windows-* |
Windows | 2 | 7 GB | 2x |
macos-* |
macOS | 3-4 | 7-14 GB | 10x |
Concurrency Limits:
| Plan | Standard Runner | macOS | Larger Runner |
|---|---|---|---|
| Free | 20 | 5 | - |
| Pro | 40 | 5 | - |
| Team | 60 | 5 | 1.000 |
| Enterprise | 500 | 50 | 1.000 |
| Shell | Plattformen | Interner Befehl | Error-Handling |
|---|---|---|---|
bash |
Alle | bash --noprofile --norc -eo pipefail {0} |
set -e, Pipefail |
sh |
Linux/macOS | sh -e {0} |
set -e |
pwsh |
Alle | pwsh -command ". '{0}'" |
$ErrorActionPreference = 'stop' |
powershell |
Windows | powershell -command ". '{0}'" |
$ErrorActionPreference = 'stop' |
cmd |
Windows | %ComSpec% /D /E:ON /V:OFF /S /C "CALL "{0}"" |
Letzter Exit Code |
python |
Alle | python {0} |
Exit Code |
Defaults:
bash (falls verfügbar, sonst
sh)pwsh| Pattern | Bedeutung | Match-Beispiele | No-Match |
|---|---|---|---|
* |
Beliebige Zeichen außer / |
feature-* → feature-x,
feature-123 |
feature/x |
** |
Beliebige Zeichen inkl. / |
docs/** → docs/a.md,
docs/sub/b.md |
- |
? |
Genau ein Zeichen | v?.0 → v1.0, v2.0 |
v10.0 |
[abc] |
Ein Zeichen aus Menge | v[12].0 → v1.0, v2.0 |
v3.0 |
[0-9] |
Ein Zeichen aus Range | page-[0-9] → page-5 |
page-10 |
!pattern |
Negation (nach positivem Match) | releases/**, !**-alpha |
- |
Branches/Tags:
branches:
- 'main'
- 'releases/**' # releases/v1, releases/beta/v2
- '!releases/**-alpha' # aber nicht releases/v1-alphaPaths:
paths:
- '**.js' # Alle .js Files
- 'src/**' # Alles unter src/
- '!src/test/**' # außer TestsWichtig:
*, [, ! am
Anfang müssen in Quotes: '**/test.js'| Funktion | Rückgabe | Verwendung | Typischer Einsatz |
|---|---|---|---|
success() |
Boolean | Alle vorherigen Steps erfolgreich | Default-Verhalten |
failure() |
Boolean | Mindestens ein vorheriger Step fehlgeschlagen | Cleanup, Notifications |
cancelled() |
Boolean | Workflow wurde gecancelt | Cleanup-Aktionen |
always() |
Boolean | Immer true | Cleanup, Reporting |
Kombinationen:
# Nur bei Failure ausführen
if: failure()
# Bei Failure oder Cancel
if: failure() || cancelled()
# Immer, aber nur auf main
if: always() && github.ref == 'refs/heads/main'
# Nur wenn vorheriger Step erfolgreich
if: steps.build.outcome == 'success'Step Outcomes:
success: Step erfolgreichfailure: Step fehlgeschlagencancelled: Step gecanceltskipped: Step übersprungen| Schlüssel | Typ | Beschreibung | Default |
|---|---|---|---|
group |
String/Expression | Eindeutiger Gruppen-Identifier | - |
cancel-in-progress |
Boolean/Expression | Laufende Runs canceln | false |
Typische Patterns:
# Pro Branch eine laufende Ausführung
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Pro PR
concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
# Nur für Deployments (keine Parallelität)
concurrency:
group: production-deploy
cancel-in-progress: false
# Conditional Cancel (nur dev-Branches)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'release/') }}Scope:
| Schlüssel | Typ | Beschreibung | Limit |
|---|---|---|---|
matrix.<variable> |
Array | Variable definieren | Max 256 Jobs |
matrix.include |
Array[Object] | Jobs/Configs hinzufügen | - |
matrix.exclude |
Array[Object] | Kombinationen ausschließen | - |
fail-fast |
Boolean | Bei erstem Failure abbrechen | true |
max-parallel |
Integer | Parallele Ausführung limitieren | Runner-abhängig |
Beispiel-Pattern:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [16, 18, 20]
# Erzeugt 6 Jobs: 2 OS × 3 Node-Versions
include:
# Extra-Kombination hinzufügen
- os: macos-latest
node: 18
exclude:
# Windows + Node 16 überspringen
- os: windows-latest
node: 16
fail-fast: false # Alle Jobs durchlaufen
max-parallel: 3 # Max 3 parallel
# Matrix-Werte nutzen:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}| Context | Workflow | Job | Step | Beschreibung |
|---|---|---|---|---|
github |
✓ | ✓ | ✓ | Event-Payload, Repo-Info, Commit-Details |
env |
- | ✓ | ✓ | Environment-Variablen |
job |
- | ✓ | ✓ | Job-Status, Container-Info |
jobs |
- | - | - | Job-Outputs (nur in needs) |
steps |
- | - | ✓ | Step-Outputs, Status |
runner |
- | ✓ | ✓ | Runner-OS, Temp-Paths |
secrets |
- | ✓ | ✓ | Repository/Org/Environment Secrets |
strategy |
- | ✓ | ✓ | Matrix-Configuration |
matrix |
- | ✓ | ✓ | Aktuelle Matrix-Werte |
needs |
- | ✓ | ✓ | Outputs von Dependencies |
inputs |
✓ | ✓ | ✓ | workflow_dispatch/workflow_call Inputs |
Wichtige github-Context-Felder:
github.actor # User der Workflow triggerte
github.event_name # push, pull_request, etc.
github.ref # refs/heads/main, refs/tags/v1.0
github.ref_name # main, v1.0 (ohne refs/)
github.sha # Commit SHA
github.repository # owner/repo
github.repository_owner # owner
github.workspace # /home/runner/work/repo/repo
github.run_id # Eindeutige Run-ID
github.run_number # Sequenzielle Run-Nummer
github.job # Job-ID| Command | Syntax | Zweck |
|---|---|---|
| Debug | echo "::debug::message" |
Debug-Log (nur mit ACTIONS_STEP_DEBUG) |
| Notice | echo "::notice::message" |
Info-Annotation (blau) |
| Warning | echo "::warning file=x.js,line=10::message" |
Warning-Annotation (gelb) |
| Error | echo "::error file=x.js,line=10::message" |
Error-Annotation (rot) |
| Group | echo "::group::title" …
echo "::endgroup::" |
Log-Output gruppieren (collapsed) |
| Mask | echo "::add-mask::$SECRET" |
Wert in Logs maskieren |
| Set Output | echo "key=value" >> $GITHUB_OUTPUT |
Step-Output setzen |
| Set Env | echo "VAR=value" >> $GITHUB_ENV |
Env-Variable für folgende Steps |
| Add Path | echo "/path" >> $GITHUB_PATH |
PATH erweitern |
| Summary | echo "## Title" >> $GITHUB_STEP_SUMMARY |
Job-Summary (Markdown) |
Annotation mit Datei-Referenz:
echo "::error file=src/app.js,line=42,col=15,title=Syntax Error::Missing semicolon"| Limit | Wert | Gilt für |
|---|---|---|
| Workflows pro Repository | Unbegrenzt | - |
| Concurrent Workflows | 20 | Pro Repository |
| Jobs pro Workflow | 256 (Matrix) | Workflow Run |
| Job-Timeout | 360 Minuten (6h) | Standard/Larger Runner |
| Workflow-Laufzeit | 35 Tage | Gesamtdauer inkl. Waiting |
| API-Requests | 1.000/h | Per Workflow |
| Artifact/Log Retention | 1-400 Tage | Plan-abhängig |
| Artifact-Größe | 10 GB | Pro Artifact |
| Job-Outputs | 1 MB | Pro Job |
| Workflow-Outputs | 50 MB | Gesamt |
| Cron-Intervall | Minimum 5 Min | schedule-Events |
| workflow_dispatch Inputs | 25 | Top-Level Properties |
| workflow_dispatch Payload | 65.535 Zeichen | Input-Daten |
| Syntax | Verwendung | Beispiel |
|---|---|---|
{owner}/{repo}/.github/workflows/{file}@{ref} |
Public/Private Repos | octo-org/workflows/.github/workflows/ci.yml@v1 |
./.github/workflows/{file} |
Selbes Repository | ./.github/workflows/reusable.yml |
Caller-Workflow:
jobs:
call-reusable:
uses: org/repo/.github/workflows/reusable.yml@main
with:
config: production
secrets:
token: ${{ secrets.API_TOKEN }}
# oder: secrets: inheritCalled-Workflow:
on:
workflow_call:
inputs:
config:
required: true
type: string
secrets:
token:
required: true
outputs:
result:
value: ${{ jobs.build.outputs.result }}
jobs:
build:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.test.outputs.result }}
steps:
- run: echo "result=success" >> $GITHUB_OUTPUT
id: testVerschachtelung:
secrets: {token: ${{ secrets.TOKEN }}}| Secret/Variable | Effekt |
|---|---|
ACTIONS_STEP_DEBUG=true |
Zeigt Expression-Evaluierung, Conditional-Checks |
ACTIONS_RUNNER_DEBUG=true |
Zeigt Runner-Internals, Job-Setup, Environment |
Aktivierung:
On-Demand (Re-Run): - Re-run jobs →
☑ Enable debug logging
Diese Referenztabellen bilden das syntaktische Rückgrat der GitHub Actions Workflow-Definition. Für detaillierte Erklärungen zu einzelnen Konzepten sei auf die entsprechenden Hauptkapitel verwiesen.