Skip to content
项目

关于

GitHub Action to expose slug value of GitHub environment variables inside your GitHub workflow

系统与基础设施

这些数字如何统计

实测星标增长

24小时
+1
7天
+2
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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-action version 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

How-To Guides

Reference

Explanation

Migration

Troubleshooting

See the troubleshooting guide for common issues and solutions.

Thanks for talking about us

In English :gb:

In French :fr:

In Chinese :cn:

The next one is you. Don't hesitate to add yourself to one of these lists.

探索相关项目

加载中…