|
|
@@ -104,11 +104,33 @@ func (c *FinalizeDeploymentHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ workflowRun, err := commonutils.GetLatestWorkflowRun(client, depl.RepoOwner, depl.RepoName,
|
|
|
+ fmt.Sprintf("porter_%s_env.yml", env.Name), depl.PRBranchFrom)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if depl.Subdomain == "" {
|
|
|
+ depl.Subdomain = "*Ingress is disabled for this deployment*"
|
|
|
+ }
|
|
|
+
|
|
|
// write comment in PR
|
|
|
- commentBody := fmt.Sprintf("Porter has deployed this pull request to the following URL:\n%s", depl.Subdomain)
|
|
|
- prComment := github.IssueComment{
|
|
|
- Body: &commentBody,
|
|
|
- User: &github.User{},
|
|
|
+ commentBody := fmt.Sprintf(
|
|
|
+ "## ✅ Porter Preview Environments\n"+
|
|
|
+ "||Deployment Information|\n"+
|
|
|
+ "|-|-|\n"+
|
|
|
+ "| Latest SHA | [`%s`](https://github.com/%s/%s/commit/%s) |\n"+
|
|
|
+ "| Live URL | %s |\n"+
|
|
|
+ "| Github Action | %s |\n"+
|
|
|
+ "| Porter Deployments URL | %s/preview-environments/details/%s?environment_id=%d |",
|
|
|
+ depl.CommitSHA, depl.RepoOwner, depl.RepoName, depl.CommitSHA, depl.Subdomain, workflowRun.GetHTMLURL(),
|
|
|
+ c.Config().ServerConf.ServerURL, depl.Namespace, depl.EnvironmentID,
|
|
|
+ )
|
|
|
+
|
|
|
+ prComment := &github.IssueComment{
|
|
|
+ Body: github.String(commentBody),
|
|
|
}
|
|
|
|
|
|
_, _, err = client.Issues.CreateComment(
|
|
|
@@ -116,7 +138,7 @@ func (c *FinalizeDeploymentHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
|
|
|
env.GitRepoOwner,
|
|
|
env.GitRepoName,
|
|
|
int(depl.PullRequestID),
|
|
|
- &prComment,
|
|
|
+ prComment,
|
|
|
)
|
|
|
|
|
|
if err != nil {
|