Zum Inhalt springen

Plugin: condition-github-actions

Bestätigt, dass das aktuelle Release innerhalb von GitHub Actions läuft. Funktioniert out-of-the-box auf github.com, GitHub Enterprise Server (GHES) sowie GitHub Enterprise Cloud mit Data Residency (*.ghe.com).

Terminal-Fenster
semrel plugin install @semrel/condition-github-actions

semrel plugin install lädt die Binärdatei nach .semrel/plugins/ herunter und aktualisiert .semrel.lock. Committe .semrel.lock, um die Version für dein Team festzuschreiben.

version: 1
plugins:
- uses: @semrel/condition-github-actions
phase: condition
args:
branch: main
NameErforderlichStandardBeschreibung
SEMREL_PLUGIN_BRANCHnein—Optionale Branch-Vorgabe. Wenn gesetzt, muss GITHUB_REF_NAME (bzw. GITHUB_REF ohne refs/heads/) diesem Wert entsprechen.
VariableErforderlichBeschreibung
GITHUB_ACTIONSjaMuss "true" sein.
GITHUB_TOKEN / GH_TOKENjaMindestens eine Token-Variable muss gesetzt sein.
GITHUB_REF_NAME / GITHUB_REFneinWird bei gesetztem SEMREL_PLUGIN_BRANCH geprüft (inkl. Fallback auf GITHUB_REF für ältere GHES-Runner).
GITHUB_SERVER_URLneinOptionale GitHub-Server-URL (z. B. https://github.com, https://ghe.example.com oder https://octocorp.ghe.com). Wird als http/https-URL validiert.
GITHUB_API_URLneinOptionale GitHub-API-URL (z. B. https://api.github.com, https://ghe.example.com/api/v3 oder https://api.octocorp.ghe.com). Wird als http/https-URL validiert.

Dieses Plugin benötigt keine der gemeinsamen SEMREL_*-Release-Kontextvariablen, um seine Aufgabe zu erledigen.

Wenn GITHUB_ACTIONS=true sowie ein gültiges Token und gültige Server-/API-URLs vorliegen, ist das Plugin sofort erfolgreich. Andernfalls schlägt die Bedingung fehl und semrel stoppt die Pipeline.