-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to set a different slug length than 63
- Loading branch information
1 parent
cd9871b
commit 88f3ee8
Showing
4 changed files
with
110 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,59 +9,76 @@ inputs: | |
description: "Value to prepend to each generated variable" | ||
default: "" | ||
required: false | ||
slug-maxlength: | ||
description: "Max length of the slugified values" | ||
default: "63" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: rlespinasse/[email protected] | ||
- run: $GITHUB_ACTION_PATH/preflight.sh | ||
shell: bash | ||
env: | ||
INPUT_SLUG_MAXLENGTH: ${{ inputs.slug-maxlength }} | ||
|
||
- uses: rlespinasse/[email protected] | ||
with: | ||
key: GITHUB_REPOSITORY | ||
value: ${{ github.repository }} | ||
prefix: ${{ inputs.prefix }} | ||
- uses: rlespinasse/[email protected] | ||
slug-maxlength: ${{ inputs.slug-maxlength }} | ||
- uses: rlespinasse/[email protected] | ||
with: | ||
key: GITHUB_REF | ||
prefix: ${{ inputs.prefix }} | ||
- uses: rlespinasse/[email protected] | ||
slug-maxlength: ${{ inputs.slug-maxlength }} | ||
- uses: rlespinasse/[email protected] | ||
with: | ||
key: GITHUB_HEAD_REF | ||
prefix: ${{ inputs.prefix }} | ||
- uses: rlespinasse/[email protected] | ||
slug-maxlength: ${{ inputs.slug-maxlength }} | ||
- uses: rlespinasse/[email protected] | ||
with: | ||
key: GITHUB_BASE_REF | ||
prefix: ${{ inputs.prefix }} | ||
slug-maxlength: ${{ inputs.slug-maxlength }} | ||
|
||
# Specific values | ||
- uses: rlespinasse/slugify-value@v1.1.0 | ||
- uses: rlespinasse/slugify-value@v1.2.0 | ||
with: | ||
key: GITHUB_EVENT_REF | ||
value: ${{ github.event.ref }} | ||
prefix: ${{ inputs.prefix }} | ||
slug-maxlength: ${{ inputs.slug-maxlength }} | ||
|
||
# Calculated values | ||
- id: get-github-ref-name | ||
run: echo "::set-output name=github-ref-name::$(echo "${{ github.head_ref || github.ref }}" | cut -d/ -f3)" | ||
shell: bash | ||
- uses: rlespinasse/slugify-value@v1.1.0 | ||
- uses: rlespinasse/slugify-value@v1.2.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 "::set-output name=github-repository-owner-part::$(echo $GITHUB_REPOSITORY | cut -d/ -f1)" | ||
shell: bash | ||
- uses: rlespinasse/slugify-value@v1.1.0 | ||
- uses: rlespinasse/slugify-value@v1.2.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 "::set-output name=github-repository-name-part::$(echo $GITHUB_REPOSITORY | cut -d/ -f2)" | ||
shell: bash | ||
- uses: rlespinasse/slugify-value@v1.1.0 | ||
- uses: rlespinasse/slugify-value@v1.2.0 | ||
with: | ||
key: GITHUB_REPOSITORY_NAME_PART | ||
value: ${{ steps.get-github-repository-name-part.outputs.github-repository-name-part }} | ||
prefix: ${{ inputs.prefix }} | ||
slug-maxlength: ${{ inputs.slug-maxlength }} | ||
|
||
# Short | ||
- uses: rlespinasse/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ -z "${INPUT_SLUG_MAXLENGTH}" ]; then | ||
echo "::error ::slug-maxlength cannot be empty" | ||
exit 1 | ||
elif [ "${INPUT_SLUG_MAXLENGTH}" != "nolimit" ] && [ ! "${INPUT_SLUG_MAXLENGTH}" -eq "${INPUT_SLUG_MAXLENGTH}" ] 2>/dev/null; then | ||
echo "::error ::slug-maxlength must be a number or equals to 'nolimit'" | ||
exit 1 | ||
fi |