From 393c8b04f7d88b9f677a052f03ded46a75cef629 Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Tue, 24 Dec 2024 22:33:13 +0100 Subject: [PATCH] fix: short sha has at least four digits (#2540) Currently it is not very unlikly to have a false match for tag `0` with sha `0XXXXXXXXXXXXXXXXXXXXXXX`, 1 to 16 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 4dc67f6ba28f888328a2568bbcacf49e552650da) --- act/common/git/git.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/act/common/git/git.go b/act/common/git/git.go index 1748e797..bffe4feb 100644 --- a/act/common/git/git.go +++ b/act/common/git/git.go @@ -340,7 +340,7 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor { logger.Errorf("Unable to resolve %s: %v", input.Ref, err) } - if hash.String() != input.Ref && strings.HasPrefix(hash.String(), input.Ref) { + if hash.String() != input.Ref && len(input.Ref) >= 4 && strings.HasPrefix(hash.String(), input.Ref) { return &Error{ err: ErrShortRef, commit: hash.String(),