diff --git a/internal/cli/run.go b/internal/cli/run.go index 837697f..545369f 100644 --- a/internal/cli/run.go +++ b/internal/cli/run.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "os" + "path/filepath" "strings" "github.com/mattn/go-shellwords" @@ -655,6 +656,21 @@ func (s Service) reportTestResults( } } + mintLinksPath := os.Getenv("MINT_LINKS") + if reportingConfiguration.Provider.ProviderName == "mint" && mintLinksPath != "" { + backlinkPath := filepath.Join(mintLinksPath, "View Captain results") + backlinkURL := fmt.Sprintf( + "https://%v/captain/deep_link/test_suite_summaries/%v/%v/%v", + reportingConfiguration.CloudHost, + reportingConfiguration.SuiteID, + reportingConfiguration.Provider.BranchName, + reportingConfiguration.Provider.CommitSha, + ) + if err := os.WriteFile(backlinkPath, []byte(backlinkURL), 0o600); err != nil { + s.Log.Warnf("Could not populate backlink in Mint") + } + } + if _, ok := s.API.(local.Client); ok && !cfg.UpdateStoredResults { return nil, nil }