Skip to content

Commit 5291119

Browse files
committed
fix
1 parent 17648e7 commit 5291119

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

tools/flakeguard/cmd/generate_report.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,12 @@ var GenerateReportCmd = &cobra.Command{
9494
hasFailedTests := summaryData.FailedRuns > 0
9595

9696
var artifactLink string
97-
if hasFailedTests {
97+
if hasFailedTests && githubRepo != "" && githubRunID != 0 {
9898
// Fetch artifact link from GitHub API
9999
artifactLink, err = fetchArtifactLink(githubToken, githubRepo, githubRunID, artifactName)
100100
if err != nil {
101101
return fmt.Errorf("error fetching artifact link: %w", err)
102102
}
103-
} else {
104-
// No failed tests, set artifactLink to empty string
105-
artifactLink = ""
106-
log.Debug().Msg("No failed tests found. Skipping artifact link generation")
107103
}
108104

109105
// Create output directory if it doesn't exist
@@ -202,12 +198,6 @@ func init() {
202198
if err := GenerateReportCmd.MarkFlagRequired("summary-path"); err != nil {
203199
log.Fatal().Err(err).Msg("Error marking flag as required")
204200
}
205-
if err := GenerateReportCmd.MarkFlagRequired("github-repository"); err != nil {
206-
log.Fatal().Err(err).Msg("Error marking flag as required")
207-
}
208-
if err := GenerateReportCmd.MarkFlagRequired("github-run-id"); err != nil {
209-
log.Fatal().Err(err).Msg("Error marking flag as required")
210-
}
211201
}
212202

213203
func fetchArtifactLink(githubToken, githubRepo string, githubRunID int64, artifactName string) (string, error) {

0 commit comments

Comments
 (0)