What Is GITHUB_REF?
GITHUB_REF is the full Git ref that triggered the workflow, such as refs/heads/main or refs/tags/v1.2.0.
GITHUB_REF tells your workflow what branch or tag is being built. Because it is the fully-qualified ref, you often want GITHUB_REF_NAME for just the short name.
Format
- Branch push:
refs/heads/<branch> - Tag push:
refs/tags/<tag> - Pull request:
refs/pull/<number>/merge
Getting the short name
Use GITHUB_REF_NAME (e.g. main or v1.2.0) instead of parsing GITHUB_REF yourself.
Key takeaways
- GITHUB_REF is the full ref that triggered the run.
- It is prefixed with refs/heads, refs/tags, or refs/pull.
- Use GITHUB_REF_NAME for the short branch/tag name.
Related guides
What Is GITHUB_REF_NAME?GITHUB_REF_NAME is the short branch or tag name for a GitHub Actions run, like main or v1.2.0. Learn how it d…
What Is GITHUB_SHA?GITHUB_SHA is the commit SHA that triggered a GitHub Actions workflow run. Learn what it contains and how to…
What Is a Release Tag?What is a release tag? Learn how version tags mark shippable commits, how semantic versioning structures them…