mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-05-17 10:25:08 +00:00
feat: support GHES step output management
This commit is contained in:
committed by
GitHub
parent
b011e83cf8
commit
a362e5fb42
44
action.yml
44
action.yml
@@ -26,30 +26,30 @@ runs:
|
||||
INPUT_SLUG_MAXLENGTH: ${{ inputs.slug-maxlength }}
|
||||
INPUT_SHORT_LENGTH: ${{ inputs.short-length }}
|
||||
|
||||
- uses: rlespinasse/slugify-value@v1.3.3
|
||||
- uses: rlespinasse/slugify-value@v1.4.0
|
||||
with:
|
||||
key: GITHUB_REPOSITORY
|
||||
value: ${{ github.repository }}
|
||||
prefix: ${{ inputs.prefix }}
|
||||
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||
- uses: rlespinasse/slugify-value@v1.3.3
|
||||
- uses: rlespinasse/slugify-value@v1.4.0
|
||||
with:
|
||||
key: GITHUB_REF
|
||||
prefix: ${{ inputs.prefix }}
|
||||
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||
- uses: rlespinasse/slugify-value@v1.3.3
|
||||
- uses: rlespinasse/slugify-value@v1.4.0
|
||||
with:
|
||||
key: GITHUB_HEAD_REF
|
||||
prefix: ${{ inputs.prefix }}
|
||||
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||
- uses: rlespinasse/slugify-value@v1.3.3
|
||||
- uses: rlespinasse/slugify-value@v1.4.0
|
||||
with:
|
||||
key: GITHUB_BASE_REF
|
||||
prefix: ${{ inputs.prefix }}
|
||||
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||
|
||||
# Specific values
|
||||
- uses: rlespinasse/slugify-value@v1.3.3
|
||||
- uses: rlespinasse/slugify-value@v1.4.0
|
||||
with:
|
||||
key: GITHUB_EVENT_REF
|
||||
value: ${{ github.event.ref }}
|
||||
@@ -58,27 +58,45 @@ runs:
|
||||
|
||||
# Calculated values
|
||||
- id: get-github-ref-name
|
||||
run: echo "github-ref-name=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_OUTPUT"
|
||||
run: |
|
||||
refname="${{ github.head_ref || github.ref_name }}"
|
||||
if [ -f "$GITHUB_OUTPUT" ]; then
|
||||
echo "github-ref-name=${refname}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "::set-output name=github-ref-name::${refname}"
|
||||
fi
|
||||
shell: bash
|
||||
- uses: rlespinasse/slugify-value@v1.3.3
|
||||
- uses: rlespinasse/slugify-value@v1.4.0
|
||||
with:
|
||||
key: GITHUB_REF_NAME
|
||||
value: ${{ steps.get-github-ref-name.outputs.github-ref-name }}
|
||||
prefix: ${{ inputs.prefix }}
|
||||
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||
- id: get-github-repository-owner-part
|
||||
run: echo "github-repository-owner-part=$(echo $GITHUB_REPOSITORY | cut -d/ -f1)" >> "$GITHUB_OUTPUT"
|
||||
run: |
|
||||
ownerpart=$(echo $GITHUB_REPOSITORY | cut -d/ -f1)
|
||||
if [ -f "$GITHUB_OUTPUT" ]; then
|
||||
echo "github-repository-owner-part=${ownerpart}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "::set-output name=github-repository-owner-part::${ownerpart}"
|
||||
fi
|
||||
shell: bash
|
||||
- uses: rlespinasse/slugify-value@v1.3.3
|
||||
- uses: rlespinasse/slugify-value@v1.4.0
|
||||
with:
|
||||
key: GITHUB_REPOSITORY_OWNER_PART
|
||||
value: ${{ steps.get-github-repository-owner-part.outputs.github-repository-owner-part }}
|
||||
prefix: ${{ inputs.prefix }}
|
||||
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||
- id: get-github-repository-name-part
|
||||
run: echo "github-repository-name-part=$(echo $GITHUB_REPOSITORY | cut -d/ -f2)" >> "$GITHUB_OUTPUT"
|
||||
run: |
|
||||
namepart=$(echo $GITHUB_REPOSITORY | cut -d/ -f2)
|
||||
if [ -f "$GITHUB_OUTPUT" ]; then
|
||||
echo "github-repository-name-part=${namepart}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "::set-output name=github-repository-name-part::${namepart}"
|
||||
fi
|
||||
shell: bash
|
||||
- uses: rlespinasse/slugify-value@v1.3.3
|
||||
- uses: rlespinasse/slugify-value@v1.4.0
|
||||
with:
|
||||
key: GITHUB_REPOSITORY_NAME_PART
|
||||
value: ${{ steps.get-github-repository-name-part.outputs.github-repository-name-part }}
|
||||
@@ -86,13 +104,13 @@ runs:
|
||||
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||
|
||||
# Short
|
||||
- uses: rlespinasse/shortify-git-revision@v1.5.1
|
||||
- uses: rlespinasse/shortify-git-revision@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@v1.5.1
|
||||
- uses: rlespinasse/shortify-git-revision@v1.6.0
|
||||
with:
|
||||
name: GITHUB_EVENT_PULL_REQUEST_HEAD_SHA
|
||||
revision: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
@@ -31,4 +31,8 @@ else
|
||||
fi
|
||||
fi
|
||||
echo "::debug ::Set PREFLIGHT_SHORT_LENGTH=$PREFLIGHT_SHORT_LENGTH"
|
||||
echo "PREFLIGHT_SHORT_LENGTH=$PREFLIGHT_SHORT_LENGTH" >> "$GITHUB_OUTPUT"
|
||||
if [ -f "$GITHUB_OUTPUT" ]; then
|
||||
echo "PREFLIGHT_SHORT_LENGTH=${PREFLIGHT_SHORT_LENGTH}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "::set-output name=PREFLIGHT_SHORT_LENGTH::${PREFLIGHT_SHORT_LENGTH}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user