writeGitHubStepSummary writes the GitHub step summary for rollout operations.
(w *world.World)
| 80 | |
| 81 | // writeGitHubStepSummary writes the GitHub step summary for rollout operations. |
| 82 | func writeGitHubStepSummary(w *world.World) error { |
| 83 | if w.Platform != world.GitHub || !w.IsRollout { |
| 84 | return nil |
| 85 | } |
| 86 | |
| 87 | filename := os.Getenv("GITHUB_STEP_SUMMARY") |
| 88 | f, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) |
| 89 | if err != nil { |
| 90 | return errors.Wrapf(err, "failed to open GitHub step summary file: %s", filename) |
| 91 | } |
| 92 | defer f.Close() |
| 93 | |
| 94 | summary := github.BuildSummaryMarkdown(w) |
| 95 | if _, err := f.WriteString(summary); err != nil { |
| 96 | return errors.Wrapf(err, "failed to write GitHub step summary: %s", filename) |
| 97 | } |
| 98 | return nil |
| 99 | } |
no test coverage detected