Skip to content

Commit

Permalink
Skip cancelling certain check runs on revision cancel in PR workflows (
Browse files Browse the repository at this point in the history
…#751)

Workflows running on the new version will only cancel the combined check
run.
  • Loading branch information
samrabelachew authored Apr 30, 2024
1 parent 7c02fcd commit 6229197
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/neptune/workflows/internal/pr/revision/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import (
)

const (
ReviewSignalID = "pr-review"
CheckRunCancelled = "checkrun was cancelled"
ReviewSignalID = "pr-review"
CheckRunCancelled = "Checkrun was cancelled, please review latest revision for Terraform changes."
SkipCancelingCheckRuns = "skip-cancelling-checkruns"
)

type TFWorkflow func(ctx workflow.Context, request terraform.Request) (terraform.Response, error)
Expand Down Expand Up @@ -182,6 +183,10 @@ func (p *Processor) markCombinedCheckRun(ctx workflow.Context, revision Revision

func (p *Processor) markCheckRunsAborted(ctx workflow.Context, revision Revision, roots map[string]RootInfo) {
p.markCombinedCheckRun(ctx, revision, github.CheckRunCancelled, CheckRunCancelled)
version := workflow.GetVersion(ctx, SkipCancelingCheckRuns, workflow.DefaultVersion, 1)
if version != workflow.DefaultVersion {
return
}

for _, rootInfo := range roots {
ctx = workflow.WithRetryPolicy(ctx, temporal.RetryPolicy{
Expand Down

0 comments on commit 6229197

Please sign in to comment.