From 32fb90b1dfe0759a139c909c522448b39286ebb1 Mon Sep 17 00:00:00 2001 From: Oleg Basov Date: Tue, 12 Nov 2024 01:08:30 +0100 Subject: [PATCH] Calculate short SHA --- .github/workflows/build-images.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index b5c3f8c..158d9ee 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -23,6 +23,13 @@ jobs: fi echo "Latest tag is $TAG" echo "::set-output name=base_version::$TAG" + + - name: Set short git commit SHA + id: get_sha + run: | + SHORT_SHA=$(git rev-parse --short ${{ github.sha }}) + echo "Short commit SHA is $SHORT_SHA" + echo "::set-output name=short_sha::$SHORT_SHA" # Setup Docker Buildx - name: Set up Docker Buildx @@ -47,7 +54,7 @@ jobs: olegeech/mvcr-application-checker:bot-${{ steps.get_tag.outputs.base_version }} build-args: | BASE_VERSION=${{ steps.get_tag.outputs.base_version }} - GIT_COMMIT=${{ github.sha::5 }} + GIT_COMMIT=${{ steps.get_sha.outputs.short_sha }} # Build and push fetcher image - name: Build and push fetcher Docker image @@ -61,4 +68,4 @@ jobs: olegeech/mvcr-application-checker:fetcher-${{ steps.get_tag.outputs.base_version }} build-args: | BASE_VERSION=${{ steps.get_tag.outputs.base_version }} - GIT_COMMIT=${{ github.sha::5 }} + GIT_COMMIT=${{ steps.get_sha.outputs.short_sha }}