mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-09-17 16:21:09 +00:00
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.
57 lines
2.0 KiB
YAML
57 lines
2.0 KiB
YAML
name: "GitHub Slug Action"
|
|
description: "GitHub Action to expose slug value of environment variables inside your GitHub workflow"
|
|
author: "Romain Lespinasse"
|
|
branding:
|
|
icon: "minimize"
|
|
color: "blue"
|
|
inputs:
|
|
prefix:
|
|
description: "Value to prepend to each generated variable"
|
|
default: ""
|
|
required: false
|
|
slug-maxlength:
|
|
description: "Max length of the slugified values"
|
|
default: "63"
|
|
required: true
|
|
short-length:
|
|
description: "Length of the shortify values (git default if empty)"
|
|
required: false
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- run: $GITHUB_ACTION_PATH/preflight.sh
|
|
id: prefligth
|
|
shell: bash
|
|
env:
|
|
INPUT_SLUG_MAXLENGTH: ${{ inputs.slug-maxlength }}
|
|
INPUT_SHORT_LENGTH: ${{ inputs.short-length }}
|
|
|
|
# From Environment Variables, Specific values and Calculated values
|
|
# Consolidated into a single step to avoid the runner printing a
|
|
# repeated "env:" dump for every shell run step (see issue #161).
|
|
- run: $GITHUB_ACTION_PATH/slugify-env.sh
|
|
id: slugify-env
|
|
shell: bash
|
|
env:
|
|
INPUT_PREFIX: ${{ inputs.prefix }}
|
|
INPUT_SLUG_MAXLENGTH: ${{ inputs.slug-maxlength }}
|
|
INPUT_GITHUB_REPOSITORY: ${{ github.repository }}
|
|
INPUT_GITHUB_EVENT_REF: ${{ github.event.ref }}
|
|
INPUT_GITHUB_REF_NAME: ${{ github.ref_name }}
|
|
GITHUB_HEAD_REF: ${{ github.head_ref }}
|
|
|
|
# From sha
|
|
- uses: rlespinasse/shortify-git-revision@c90ba7007ef6c152254d10b9f1a327966ab13077 # v1.6.0
|
|
with:
|
|
name: GITHUB_SHA
|
|
short-on-error: true
|
|
length: ${{ steps.prefligth.outputs.PREFLIGHT_SHORT_LENGTH }}
|
|
prefix: ${{ inputs.prefix }}
|
|
- uses: rlespinasse/shortify-git-revision@c90ba7007ef6c152254d10b9f1a327966ab13077 # v1.6.0
|
|
with:
|
|
name: GITHUB_EVENT_PULL_REQUEST_HEAD_SHA
|
|
revision: ${{ github.event.pull_request.head.sha }}
|
|
short-on-error: true
|
|
length: ${{ steps.prefligth.outputs.PREFLIGHT_SHORT_LENGTH }}
|
|
prefix: ${{ inputs.prefix }}
|