From cd9871b66e11e9562e3f72469772fe100be4c95a Mon Sep 17 00:00:00 2001 From: rlespinasse Date: Sat, 19 Mar 2022 07:42:20 +0100 Subject: [PATCH] fix(short): populate GITHUB_SHA_SHORT correctly --- .github/workflows/github-slug-action.yml | 41 ++++++++++++++++++++---- action.yml | 10 +++--- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/.github/workflows/github-slug-action.yml b/.github/workflows/github-slug-action.yml index 3eae3dc..9350939 100644 --- a/.github/workflows/github-slug-action.yml +++ b/.github/workflows/github-slug-action.yml @@ -7,12 +7,9 @@ jobs: matrix: os: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} - concurrency: - group: os-testing-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Load using v3.x uses: rlespinasse/github-slug-action@v3.x - name: Load using v4.x with prefix @@ -107,20 +104,50 @@ jobs: [[ "${{ env.GITHUB_REF_NAME_SLUG_CS }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG_CS }}" ]] [[ "${{ env.GITHUB_REF_NAME_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG_URL_CS }}" ]] shell: bash - - name: Print // Short SHA variables + - name: Validate // Short SHA variables run: | echo "sha : ${{ env.V4_GITHUB_SHA_SHORT }}" echo "pull request sha : ${{ env.V4_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" + [[ "${{ env.GITHUB_SHA_SHORT }}" == "${{ env.V4_GITHUB_SHA_SHORT }}" ]] + [[ "${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" == "${{ env.V4_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" ]] + shell: bash + + os-testing-without-checkout: + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + path: this-action + ref: ${{ github.ref }} + - name: Load using v3.x + uses: rlespinasse/github-slug-action@v3.x + - name: Load using v4.x with prefix + uses: ./this-action + with: + prefix: V4_ + - name: Validate // Short SHA variables + run: | + echo "sha : ${{ env.V4_GITHUB_SHA_SHORT }}" + echo "pull request sha : ${{ env.V4_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" + [[ "${{ env.GITHUB_SHA_SHORT }}" == "${{ env.V4_GITHUB_SHA_SHORT }}" ]] + [[ "${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" == "${{ env.V4_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" ]] shell: bash release: runs-on: ubuntu-latest concurrency: group: release-${{ github.ref }}-${{ github.event_name }} - needs: os-testing + needs: + - os-testing + - os-testing-without-checkout steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Release this GitHub Action uses: rlespinasse/release-that@v1 with: diff --git a/action.yml b/action.yml index 6584129..5f8008a 100644 --- a/action.yml +++ b/action.yml @@ -64,14 +64,16 @@ runs: prefix: ${{ inputs.prefix }} # Short - - uses: rlespinasse/shortify-git-revision@v1.3.0 + - uses: rlespinasse/shortify-git-revision@v1.4.0 with: name: GITHUB_SHA - continue-on-error: true + short-on-error: true + length: 8 prefix: ${{ inputs.prefix }} - - uses: rlespinasse/shortify-git-revision@v1.3.0 + - uses: rlespinasse/shortify-git-revision@v1.4.0 with: name: GITHUB_EVENT_PULL_REQUEST_HEAD_SHA revision: ${{ github.event.pull_request.head.sha }} - continue-on-error: true + short-on-error: true + length: 8 prefix: ${{ inputs.prefix }}