2021-01-25 20:01:05 +01:00
2021-01-25 20:01:05 +01:00
2020-04-25 22:04:15 +02:00
2021-01-12 09:23:14 +00:00
2019-11-07 12:23:07 +01:00
2020-12-18 17:39:27 +01:00
2021-01-25 20:01:05 +01:00
2021-01-25 20:01:05 +01:00

GitHub Slug action

Actions Status GitHub Super-Linter Public workflows that use this action. Licence

This GitHub Action will expose the slug/short values of some GitHub environment variables inside your GitHub workflow.

Table of Contents

Overview

SLUG a variable will

  • put the variable content in lower case
  • replace any character by - except 0-9, a-z, and .
  • remove leading and trailing - character
  • limit the string size to 63 characters
Others Slug-ish commands are available

  • SLUG_URL a variable to have a slug variable compliant to be used in an URL (Like SLUG but . is also replaced by -)

  • SHORT a variable will limit the string size to 8 characters (useful for sha value)

Use this action

Add this in your workflow

- name: Inject slug/short variables
  uses: rlespinasse/github-slug-action@v3.x

Check for more examples (OS usage, URL use, ...)

Tip: Use Dependabot to maintain your github-slug-action version updated in your GitHub workflows.

Available Environment variables

Note: If you don't find what you search for, read more about available GitHub variables, and propose a new custom variable.

Slug variables

Variable Slug version of Description
GITHUB_REPOSITORY_SLUG GITHUB_REPOSITORY The owner and repository name.
GITHUB_REF_SLUG GITHUB_REF The branch or tag ref that triggered the workflow.
GITHUB_HEAD_REF_SLUG GITHUB_HEAD_REF The branch of the head repository.
Only set for forked repositories.
GITHUB_BASE_REF_SLUG GITHUB_BASE_REF The branch of the base repository.
Only set for forked repositories.
GITHUB_EVENT_REF_SLUG github.event.ref Only set for create, and delete webhook events.

Slug URL variables

Variable Slug version of Description
GITHUB_REPOSITORY_SLUG_URL GITHUB_REPOSITORY The owner and repository name.
GITHUB_REF_SLUG_URL GITHUB_REF The branch or tag ref that triggered the workflow.
GITHUB_HEAD_REF_SLUG_URL GITHUB_HEAD_REF The branch of the head repository.
Only set for forked repositories.
GITHUB_BASE_REF_SLUG_URL GITHUB_BASE_REF The branch of the base repository.
Only set for forked repositories.
GITHUB_EVENT_REF_SLUG_URL github.event.ref Only set for create, and delete webhook events.

Short variables

Variable Short version of Description
GITHUB_SHA_SHORT GITHUB_SHA The commit SHA that triggered the workflow.
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT github.event.pull_request.head.sha The commit SHA on pull request that trigger workflow.
Only set for pull_request, pull_request_review, pull_request_review_comment, and pull_request_target webhook events.

Contribute

Follow Developers guide

Troubleshooting

An action could not be found at the URI

If your workflow fail on the Set up job task with this kind of log :

Download action repository 'rlespinasse/github-slug-action@master'
##[error]An action could not be found at the URI 'https://api.github.com/repos/rlespinasse/github-slug-action/tarball/master'

The master branch don't exists anymore.

The master branch EOL have been set to 2020-10-25 after a 6-month deprecation period (more information on the EOL issue)

Please, use the current branch v3.x or a version tag (see releases pages) in order to fix your workflow.

Thanks for talking about us

Languages
Shell 100%