enable to resolve commit hash in uses (#530)

Co-authored-by: sinozu <[email protected]>
Co-authored-by: Casey Lee <[email protected]>
This commit is contained in:
authored and GitHub committed 2021-02-23 09:50:28 -08:00
1 parent 34dc2dc15c
commit 14c06ee5e4
2 files changed
+13 -2

No files matched your search

+8 -2
View File
@@ -244,8 +244,14 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor {
refType := "tag"
rev := plumbing.Revision(path.Join("refs", "tags", input.Ref))
if _, err := r.Tag(input.Ref); errors.Is(err, git.ErrTagNotFound) {
refType = "branch"
rev = plumbing.Revision(path.Join("refs", "remotes", "origin", input.Ref))
rName := plumbing.ReferenceName(path.Join("refs", "remotes", "origin", input.Ref))
if _, err := r.Reference(rName, false); errors.Is(err, plumbing.ErrReferenceNotFound) {
refType = "sha"
rev = plumbing.Revision(input.Ref)
} else {
refType = "branch"
rev = plumbing.Revision(rName)
}
}
hash, err := r.ResolveRevision(rev)
if err != nil {