Skip to content

Commit

Permalink
fix(short): populate GITHUB_SHA_SHORT correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse committed Mar 19, 2022
1 parent 1fb0eeb commit cd9871b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 deletions.
41 changes: 34 additions & 7 deletions .github/workflows/github-slug-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- name: Load using v4.x with prefix
Expand Down Expand Up @@ -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/[email protected]
- 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:
Expand Down
10 changes: 6 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit cd9871b

Please sign in to comment.