Skip to content

Commit 87be2fa

Browse files
Update .github/scripts/verify_showcase_version.go
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 9aac985 commit 87be2fa

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

.github/scripts/verify_showcase_version.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,25 @@ func main() {
4646
os.Exit(1)
4747
}
4848

49-
outputLine := strings.TrimSpace(string(outputBytes))
50-
if outputLine == "" {
51-
fmt.Fprintf(os.Stderr, "Error: Tag %s not found on remote %s\n", tagName, remoteUrl)
52-
os.Exit(1)
49+
var expectedCommit string
50+
for _, line := range strings.Split(strings.TrimSpace(string(outputBytes)), "\n") {
51+
fields := strings.Fields(line)
52+
if len(fields) < 2 {
53+
continue
54+
}
55+
if fields[1] == "refs/tags/"+tagName+"^{}" {
56+
expectedCommit = fields[0]
57+
break
58+
}
59+
if fields[1] == "refs/tags/"+tagName {
60+
expectedCommit = fields[0]
61+
}
5362
}
5463

55-
outputFields := strings.Fields(outputLine)
56-
if len(outputFields) < 2 {
57-
fmt.Fprintf(os.Stderr, "Error parsing git ls-remote output: %q\n", outputLine)
64+
if expectedCommit == "" {
65+
fmt.Fprintf(os.Stderr, "Error: Tag %s not found on remote %s\n", tagName, remoteUrl)
5866
os.Exit(1)
5967
}
60-
expectedCommit := strings.TrimSpace(outputFields[0])
6168
fmt.Printf("Expected commit for tag %s: %s\n", tagName, expectedCommit)
6269

6370
if *showcaseCommit != expectedCommit {

0 commit comments

Comments
 (0)