[Fix] Explicitly set commit tags from git commits to 7 characters for deterministic CI (#1039)

* fix commit tags from git commits to 7 characters for determinism

* empty

* empty
This commit is contained in:
kyzooghost
2025-05-22 22:01:29 +10:00
committed by GitHub
parent af0471b953
commit c07457ebba
4 changed files with 7 additions and 7 deletions

View File

@@ -74,9 +74,9 @@ runs:
run: |
# For PR, GITHUB_SHA is NOT the last commit pushed onto the PR branch - https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "commithash=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
echo "commithash=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
else
echo "commithash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_OUTPUT
echo "commithash=$(git rev-parse --short=7 $GITHUB_SHA)" >> $GITHUB_OUTPUT
fi
- name: set docker tag

View File

@@ -34,7 +34,7 @@ jobs:
# Note that we cannot use GITHUB_SHA here because it will always reference the head of main branch
# Since we intend for this workflow to run only for PRs from an external fork, we want COMMIT_TAG to match the PR branch head
run: |
echo "COMMIT_TAG=$(git rev-parse --short ${{ github.event.workflow_run.head_sha }})" >> $GITHUB_OUTPUT
echo "COMMIT_TAG=$(git rev-parse --short=7 ${{ github.event.workflow_run.head_sha }})" >> $GITHUB_OUTPUT
- name: Show commit tag
run: |
echo "COMMIT_TAG: ${{ steps.compute-commit-tag.outputs.COMMIT_TAG }}"

View File

@@ -32,11 +32,11 @@ jobs:
run: |
# For PR, GITHUB_SHA is NOT the last commit pushed onto the PR branch - https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "COMMIT_TAG=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
echo "COMMIT_TAG=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
else
echo "COMMIT_TAG=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_OUTPUT
echo "COMMIT_TAG=$(git rev-parse --short=7 $GITHUB_SHA)" >> $GITHUB_OUTPUT
fi
echo LAST_COMMIT_TAG=$(git rev-parse --short "${{ env.EVENT_BEFORE }}") >> $GITHUB_OUTPUT
echo LAST_COMMIT_TAG=$(git rev-parse --short=7 "${{ env.EVENT_BEFORE }}") >> $GITHUB_OUTPUT
echo DEVELOP_TAG=develop >> $GITHUB_OUTPUT
- name: Show version tags
id: step2

View File

@@ -2,7 +2,7 @@
SHELL := /usr/bin/env bash
CORSET_ROOT := $(shell pwd)/../go-corset
VERSION := $(shell git rev-parse --short HEAD)
VERSION := $(shell git rev-parse --short=7 HEAD)
LINUX_AMD64_FLAGS := CGO_ENABLED=1 CC="x86_64-linux-musl-gcc" CXX="x86_64-linux-musl-g++" GOOS="linux" GOARCH="amd64"
DARWIN_ARM64_FLAGS := CGO_ENABLED=1 GOOS="linux" GOARCH="arm64"