Skip to content

Commit 79cfe88

Browse files
authored
Fix conclusion in checks api call (#2483)
1 parent 9b9539b commit 79cfe88

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

backend/controllers/projects_helpers.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,13 @@ func UpdateCheckRunForJob(gh utils.GithubClientProvider, job *models.DiggerJob)
280280
return fmt.Errorf("could not get conclusion for job: %v", err)
281281
}
282282

283+
// Only pass conclusion to GitHub API when job is completed (non-empty conclusion).
284+
// GitHub rejects empty string as conclusion - it must be omitted for in-progress jobs.
285+
var conclusionPtr *string
286+
if conclusion != "" {
287+
conclusionPtr = &conclusion
288+
}
289+
283290
text := "" +
284291
"```terraform\n" +
285292
job.TerraformOutput +
@@ -296,7 +303,7 @@ func UpdateCheckRunForJob(gh utils.GithubClientProvider, job *models.DiggerJob)
296303
title := fmt.Sprintf("%v to create %v to update %v to delete", job.DiggerJobSummary.ResourcesCreated, job.DiggerJobSummary.ResourcesUpdated, job.DiggerJobSummary.ResourcesDeleted)
297304
opts := github.GithubCheckRunUpdateOptions{
298305
Status: &status,
299-
Conclusion: &conclusion,
306+
Conclusion: conclusionPtr,
300307
Title: &title,
301308
Summary: &summary,
302309
Text: &text,
@@ -310,7 +317,7 @@ func UpdateCheckRunForJob(gh utils.GithubClientProvider, job *models.DiggerJob)
310317
title := fmt.Sprintf("%v created %v updated %v deleted", job.DiggerJobSummary.ResourcesCreated, job.DiggerJobSummary.ResourcesUpdated, job.DiggerJobSummary.ResourcesDeleted)
311318
opts := github.GithubCheckRunUpdateOptions{
312319
Status: &status,
313-
Conclusion: &conclusion,
320+
Conclusion: conclusionPtr,
314321
Title: &title,
315322
Summary: &summary,
316323
Text: &text,

0 commit comments

Comments
 (0)