Skip to content

Commit

Permalink
provide links to runs in queue instead of commits in queue
Browse files Browse the repository at this point in the history
  • Loading branch information
tlin4194 committed Oct 31, 2024
1 parent 43ccc09 commit cbf4fa5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ func BuildRevisionURLMarkdown(repoFullName string, revision string) string {
// uses Markdown formatting to generate the link on GH
return fmt.Sprintf("[%s](https://github.com/%s/commit/%s)", revision, repoFullName, revision)
}

func BuildRunURLMarkdown(repoFullName string, revision string, runId int64) string {
// uses Markdown formatting to generate the link on GH
return fmt.Sprintf("[%s](https://github.com/%s/runs/%d)", revision, repoFullName, runId)
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ func (q *Deploy) Push(msg terraform.DeploymentInfo) {
func (q *Deploy) GetQueuedRevisionsSummary() string {
var revisions []string
if q.IsEmpty() {
return "No other revisions ahead In queue."
return "No other runs ahead in queue."
}
for _, deploy := range q.Scan() {
revisionLink := github.BuildRevisionURLMarkdown(deploy.Repo.GetFullName(), deploy.Commit.Revision)
revisions = append(revisions, revisionLink)
runLink := github.BuildRunURLMarkdown(deploy.Repo.GetFullName(), deploy.Commit.Revision, deploy.CheckRunID)
revisions = append(revisions, runLink)
}
return fmt.Sprintf("Revisions in queue: %s", strings.Join(revisions, ", "))
return fmt.Sprintf("Runs in queue: %s", strings.Join(revisions, ", "))
}

// priority is a simple 2 priority queue implementation
Expand Down
4 changes: 2 additions & 2 deletions server/neptune/workflows/internal/deploy/terraform/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (n *StateReceiver) Receive(ctx workflow.Context, c workflow.ReceiveChannel,

revisionsSummary := n.Queue.GetQueuedRevisionsSummary()
state := github.CheckRunQueued
revisionLink := github.BuildRevisionURLMarkdown(deploymentInfo.Repo.GetFullName(), deploymentInfo.Commit.Revision)
summary := fmt.Sprintf("This deploy is queued pending action on revision %s.\n%s", revisionLink, revisionsSummary)
runLink := github.BuildRunURLMarkdown(deploymentInfo.Repo.GetFullName(), deploymentInfo.Commit.Revision, deploymentInfo.CheckRunID)
summary := fmt.Sprintf("This deploy is queued pending action on run for revision %s.\n%s", runLink, revisionsSummary)

for _, i := range infos {
request := notifier.GithubCheckRunRequest{
Expand Down

0 comments on commit cbf4fa5

Please sign in to comment.