Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle cases where GitHub release does not exist for tag #3116

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tools/version-tracker/pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,17 @@ func GetLatestRevision(client *github.Client, org, repo, currentRevision string,
}
}
releaseForTag, _, err := client.Repositories.GetReleaseByTag(context.Background(), org, repo, tagName)
preRelease := false
if err != nil {
return "", false, fmt.Errorf("calling GetReleaseByTag API for tag %s in [%s/%s] repository: %v", tagName, org, repo, err)
if strings.Contains(err.Error(), "404 Not Found") {
preRelease = false
} else {
return "", false, fmt.Errorf("calling GetReleaseByTag API for tag %s in [%s/%s] repository: %v", tagName, org, repo, err)
}
} else {
preRelease = *releaseForTag.Prerelease
}
if *releaseForTag.Prerelease {
if preRelease {
continue
}

Expand Down