feat: use composite action instead of node

Using composite with two actions:
- rlespinasse/slugify-value for the SLUG features
- rlespinasse/shortify-git-revision for the SHORT feature

Since the SHORT sha is now based on a shorted git revision,
and no more on a fix substring.

BREAKING CHANGE: use different backend for the action
This commit is contained in:
rlespinasse
2021-12-09 22:20:56 +01:00
committed by Romain Lespinasse
parent 5d786b4cd2
commit 4405613430

View File

@@ -1,9 +1,62 @@
name: "GitHub Slug Action" name: "GitHub Slug Action"
description: "GitHub Action to expose slug value of environment variables inside your GitHub workflow" description: "GitHub Action to expose slug value of environment variables inside your GitHub workflow"
author: 'rlespinasse' author: "Romain Lespinasse"
runs:
using: 'node12'
main: 'dist/index.js'
branding: branding:
icon: "minimize" icon: "minimize"
color: "blue" color: "blue"
runs:
using: "composite"
steps:
- uses: rlespinasse/slugify-value@v1.1.0
with:
key: GITHUB_REPOSITORY
value: ${{ github.repository }}
- uses: rlespinasse/slugify-value@v1.1.0
with:
key: GITHUB_REF
- uses: rlespinasse/slugify-value@v1.1.0
with:
key: GITHUB_HEAD_REF
- uses: rlespinasse/slugify-value@v1.1.0
with:
key: GITHUB_BASE_REF
# Specific values
- uses: rlespinasse/slugify-value@v1.1.0
with:
key: GITHUB_EVENT_REF
value: ${{ github.event.ref }}
# 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
with:
key: GITHUB_REF_NAME
value: ${{ steps.get-github-ref-name.outputs.github-ref-name }}
- 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
with:
key: GITHUB_REPOSITORY_OWNER_PART
value: ${{ steps.get-github-repository-owner-part.outputs.github-repository-owner-part }}
- 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
with:
key: GITHUB_REPOSITORY_NAME_PART
value: ${{ steps.get-github-repository-name-part.outputs.github-repository-name-part }}
# Short
- uses: rlespinasse/shortify-git-revision@v1.2.0
with:
name: GITHUB_SHA
continue-on-error: true
- uses: rlespinasse/shortify-git-revision@v1.2.0
with:
name: GITHUB_EVENT_PULL_REQUEST_HEAD_SHA
revision: ${{ github.event.pull_request.head.sha }}
continue-on-error: true