Skip to content

Plugin: condition-github-actions

Confirms the current release is running inside GitHub Actions. Works seamlessly on github.com, GitHub Enterprise Server (GHES), and GitHub Enterprise Cloud with data residency (*.ghe.com).

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

semrel plugin install downloads the binary to .semrel/plugins/ and updates .semrel.lock. Commit .semrel.lock to pin the version for your team.

Pre-built, signed multi-platform images (linux/amd64, linux/arm64) are published on every release:

Terminal window
docker pull ghcr.io/semrels/condition-github-actions:latest

Verify the image signature with cosign:

Terminal window
cosign verify ghcr.io/semrels/condition-github-actions:latest \
--certificate-identity-regexp 'https://github.com/SemRels/condition-github-actions/.github/workflows/release.yml.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
version: 1
plugins:
- uses: @semrel/condition-github-actions
phase: condition
args:
branch: main
NameRequiredDefaultDescription
SEMREL_PLUGIN_BRANCHno—Optional branch name override. When set, requires GITHUB_REF_NAME (or GITHUB_REF stripped of refs/heads/) to match this value.
VariableRequiredDescription
GITHUB_ACTIONSyesMust be "true".
GITHUB_TOKEN / GH_TOKENyesAt least one token variable must be non-empty.
GITHUB_REF_NAME / GITHUB_REFnoChecked when SEMREL_PLUGIN_BRANCH is set; automatically falls back to GITHUB_REF (refs/heads/<branch>) on older GHES runners.
GITHUB_SERVER_URLnoOptional GitHub server URL (e.g. https://github.com, https://ghe.example.com, or https://octocorp.ghe.com). Validated as an http/https URL when set.
GITHUB_API_URLnoOptional GitHub API URL (e.g. https://api.github.com, https://ghe.example.com/api/v3, or https://api.octocorp.ghe.com). Validated as an http/https URL when set.

This plugin does not require any of the shared SEMREL_* release context variables to do its job.

When GITHUB_ACTIONS=true and a valid token + URL environment is present, the plugin succeeds immediately. Otherwise the condition fails and SemRel stops the pipeline.