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

Update planpreview comment format #4101

Merged
merged 2 commits into from
Jan 5, 2023
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
14 changes: 8 additions & 6 deletions tool/actions-plan-preview/planpreview.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult) string {
b.WriteString(fmt.Sprintf(hasChangeTitleFormat, event.HeadCommit, len(r.Applications)))

changedApps, pipelineApps, quickSyncApps := groupApplicationResults(r.Applications)
if len(changedApps)+len(pipelineApps)+len(quickSyncApps) > 0 {
b.WriteString("\n## Plans\n\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
b.WriteString("\n## Plans\n\n")
b.WriteString("\n## Plans Preview\n\n")

how about this?

Copy link
Member Author

@knanao knanao Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umm, if u wanna do this, I feel Plan Preview or Plan Previews are more natural.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I think I will go with Plan Preview but it's up to you 👍

Copy link
Member Author

@knanao knanao Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, I feel Plans is enough because this action is planpreview, so let's keep this. 🙌

}

var detailLen int

for _, app := range changedApps {
fmt.Fprintf(&b, "\n## %s\n", makeTitleText(&app.ApplicationInfo))
fmt.Fprintf(&b, "\n### %s\n", makeTitleText(&app.ApplicationInfo))
fmt.Fprintf(&b, "Sync strategy: %s\n", app.SyncStrategy)
fmt.Fprintf(&b, "Summary: %s\n\n", app.PlanSummary)

Expand Down Expand Up @@ -211,7 +213,7 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult) string {
}

if len(pipelineApps)+len(quickSyncApps) > 0 {
b.WriteString("\n## No resource changes were detected but the following apps will also be triggered\n")
b.WriteString("\n### No resource changes were detected but the following apps will also be triggered\n")

if len(pipelineApps) > 0 {
b.WriteString("\n###### `PIPELINE`\n")
Expand All @@ -232,13 +234,13 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult) string {
return b.String()
}

fmt.Fprintf(&b, "\n---\n\n## NOTE\n\n")
fmt.Fprintf(&b, "\n## NOTE\n\n")

if len(r.FailureApplications) > 0 {
fmt.Fprintf(&b, "**An error occurred while building plan-preview for the following applications**\n")

for _, app := range r.FailureApplications {
fmt.Fprintf(&b, "\n## %s\n", makeTitleText(&app.ApplicationInfo))
fmt.Fprintf(&b, "\n### %s\n", makeTitleText(&app.ApplicationInfo))
fmt.Fprintf(&b, "Reason: %s\n\n", app.Reason)

var lang = "diff"
Expand All @@ -256,7 +258,7 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult) string {
fmt.Fprintf(&b, "**An error occurred while building plan-preview for applications of the following Pipeds**\n")

for _, piped := range r.FailurePipeds {
fmt.Fprintf(&b, "\n## piped: [%s](%s)\n", piped.PipedID, piped.PipedURL)
fmt.Fprintf(&b, "\n### piped: [%s](%s)\n", piped.PipedID, piped.PipedURL)
fmt.Fprintf(&b, "Reason: %s\n\n", piped.Reason)
}
}
Expand Down