mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-09-15 07:12:20 +00:00
6ccfb32fbbd468fa6e692b9ffd6dab5d96ff65d1
Replace the 9 separate rlespinasse/slugify-value composite action calls (plus the 2 helper id steps feeding them) with a single in-repo slugify-env.sh script that reimplements the same slug/slug-cs/slug-url/ slug-url-cs logic for all 9 GitHub context keys in one pass. Each shell run step triggers the runner's own log renderer to print a full "env:" dump; with 9 separate steps that dump was repeated ~9 times per job. This collapses those calls into a single step, cutting the env-dump repetition ~9x with no change to any GITHUB_ENV variable name or value consumers rely on. Note: the "publish-env" input on slugify-value never controlled this log dump (it only gates writing computed values to GITHUB_ENV); the fix is purely a step-count reduction, per the maintainer's own comment on the issue.
GitHub Slug Action
This GitHub Action exposes slug and short values of GitHub environment variables inside your workflow.
Quick Start
steps:
- uses: actions/checkout@v6
- name: Inject enhanced GitHub environment variables
uses: rlespinasse/github-slug-action@v5
Caution
Use Dependabot to maintain your
github-slug-actionversion updated in your GitHub workflows.
What It Does
- SLUG -- Lowercase, replace special characters with
-, limit to 63 characters. Dots and underscores preserved. - SLUG_URL -- Same as SLUG, but dots and underscores are also replaced. Safe for URLs and subdomains.
- SHORT -- Shorten Git SHA values to a unique prefix.
- PART -- Extract portions of a variable (e.g., owner or repository name from
GITHUB_REPOSITORY). - _CS -- Case-sensitive variants of SLUG and SLUG_URL (original casing preserved).
Tip
Read the slug transformation rules for the full algorithm and rationale.
Inputs
| Input | Default | Description |
|---|---|---|
prefix |
"" |
Value prepended to each generated variable name |
slug-maxlength |
63 |
Max length of slugified values ("nolimit" to disable) |
short-length |
(Git default) | Length of short SHA values (minimum 4) |
See the inputs reference for details.
Available Variables
| Variable | Type | Description |
|---|---|---|
| GITHUB_REF_POINT | Enhanced | Branch or tag name (consistent across event types) |
| GITHUB_REPOSITORY_OWNER_PART | Partial | Owner extracted from repository |
| GITHUB_REPOSITORY_NAME_PART | Partial | Repository name extracted from repository |
| GITHUB_REPOSITORY_SLUG | Slug | The owner and repository name |
| GITHUB_REF_SLUG | Slug | The branch or tag ref |
| GITHUB_REF_NAME_SLUG | Slug | The branch or tag name shown on GitHub |
| GITHUB_HEAD_REF_SLUG | Slug | PR head branch |
| GITHUB_BASE_REF_SLUG | Slug | PR base branch |
| GITHUB_EVENT_REF_SLUG | Slug | Webhook Git ref |
| GITHUB_SHA_SHORT | Short | Shortened commit SHA |
| GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT | Short | Shortened PR head commit SHA |
All slug variables also have _SLUG_URL and _CS variants. See the full variable reference.
Tip
If you don't find what you need, read about available GitHub variables, propose a new variable, or use slugify-value / shortify-git-revision directly.
Documentation
Tutorial
- Getting started -- Step-by-step guide for first-time users
How-To Guides
- Use a prefix
- Configure slug max length
- Configure short SHA length
- Use slug variables in URLs
- More workflow examples (OS-specific usage, URL patterns)
Reference
- Variable reference -- All variables with transformation examples
- Inputs reference -- Action inputs specification
- GitHub variables by event -- Which variables are available per event type
Explanation
- Slug transformation rules -- How and why transformations work
Migration
- Migrate from v4 to v5 --
GITHUB_REF_NAMEbehaviour changed on pull request events - Migrate from v3 to v4 -- Short SHA length is now determined by Git
Troubleshooting
See the troubleshooting guide for common issues and solutions.
Thanks for talking about us
In English 🇬🇧
- Action spotlight by Michael Heap
- Serverless Deploy Previews on GitHub Actions
- Let's Build a Continuous Delivery and Branching Process with GitHub Actions, Vercel and Heroku
In French 🇫🇷
- Mettre en place une CI/CD Angular avec GitHub Actions & Netlify
- GitHub Actions : enfin des pipelines accessibles aux développeurs
- GitHub-slug-action : 5 ans d'open source pour cette GitHub Action essentielle au CI/CD
In Chinese 🇨🇳
The next one is you. Don't hesitate to add yourself to one of these lists.
Description
No description provided
continuous-deliverycontinuous-deploymentcontinuous-integrationgithub-actionshacktoberfestshortslugworkflows
Readme
MIT
4.1 MiB
Languages
Shell
100%