Skip to content

Commit b9bfd08

Browse files
ZIJmotatoes
andauthored
Delete old plan comments on PR update (#1943)
* Add the ability to auto-nuke previous comments --------- Co-authored-by: motatoes <moe.habib9@gmail.com>
1 parent 9b5ea65 commit b9bfd08

File tree

27 files changed

+249
-18
lines changed

27 files changed

+249
-18
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ Digger runs Terraform natively in your CI. This is:
2323
- Open Policy Agent (OPA) support for RBAC
2424
- PR-level locks (on top of Terraform native state locks, similar to Atlantis) to avoid race conditions across multiple PRs
2525
- Terragrunt, Workspaces, multiple Terraform versions, static analysis via Checkov, plan persistence, ...
26-
- Drift detection
27-
26+
- Drift detection
2827

2928
## Getting Started
3029

@@ -34,6 +33,7 @@ Digger runs Terraform natively in your CI. This is:
3433
## How it works
3534

3635
Digger has 2 main components:
36+
3737
- CLI that runs inside your CI and calls Terraform with the right arguments
3838
- Orchestrator - a minimal backend (that can also be self-hosted) that triggers CI jobs in response to events such as PR comments
3939

@@ -49,7 +49,8 @@ Digger also stores PR-level locks and plan cache in your cloud account (DynamoDB
4949
- Apply-after-merge workflows
5050
- Web UI (cloud-based)
5151
- Read more about differences with Atlantis in our [blog post](https://medium.com/@DiggerHQ/digger-and-atlantis-key-differences-c08029ffe112)
52-
52+
53+
5354
## Compared to Terraform Cloud and other TACOs
5455

5556
- Open source; orchestrator can be self-hosted
@@ -67,7 +68,7 @@ Please pick an issue that already exists if you’re interested in contributing,
6768

6869
Not sure where to get started? You can:
6970

70-
- Join our <a href="https://join.slack.com/t/diggertalk/shared_invite/zt-1tocl4w0x-E3RkpPiK7zQkehl8O78g8Q">Slack</a>, and ask us any questions there.
71+
- Join our <a href="https://join.slack.com/t/diggertalk/shared_invite/zt-1tocl4w0x-E3RkpPiK7zQkehl8O78g8Q">Slack</a>, and ask us any questions there.
7172

7273
## Telemetry
7374

@@ -76,7 +77,15 @@ Digger collects anonymized telemetry. See [usage.go](https://github.com/diggerhq
7677
## Running migrations
7778

7879
```
79-
atlas migrate apply --url $DATABASE_URL
80+
atlas migrate apply --url $DATABASE_URL --allow-dirty
81+
```
82+
83+
## Local postgres
84+
85+
Might need disabling ssl if running default docker image
86+
87+
```
88+
export DATABASE_URL=postgres://postgres:root@localhost:5432/postgres?sslmode=disable
8089
```
8190

8291
## Resources

backend/controllers/projects.go

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ type SetJobStatusRequest struct {
492492
JobSummary *iac_utils.IacSummary `json:"job_summary"`
493493
Footprint *iac_utils.IacPlanFootprint `json:"job_plan_footprint"`
494494
PrCommentUrl string `json:"pr_comment_url"`
495+
PrCommentId string `json:"pr_comment_id"`
495496
TerraformOutput string `json:"terraform_output"`
496497
}
497498

@@ -527,6 +528,7 @@ func (d DiggerController) SetJobStatusForProject(c *gin.Context) {
527528
"jobId", jobId,
528529
"currentStatus", job.Status,
529530
"newStatus", request.Status,
531+
"prCommentId", request.PrCommentId,
530532
"batchId", job.BatchID,
531533
)
532534

@@ -566,8 +568,20 @@ func (d DiggerController) SetJobStatusForProject(c *gin.Context) {
566568
)
567569
}
568570

571+
var prCommentId *int64
572+
num, err := strconv.ParseInt(request.PrCommentId, 10, 64)
573+
if err != nil {
574+
slog.Debug("could not parse commentID", "prCommentId", prCommentId, "error", err)
575+
slog.Warn("setting prCommentId to nil since could not parse")
576+
prCommentId = nil
577+
} else {
578+
prCommentId = &num
579+
}
580+
569581
job.PRCommentUrl = request.PrCommentUrl
570-
err := models.DB.UpdateDiggerJob(job)
582+
job.PRCommentId = prCommentId
583+
584+
err = models.DB.UpdateDiggerJob(job)
571585
if err != nil {
572586
slog.Error("Error updating job",
573587
"jobId", jobId,
@@ -820,6 +834,11 @@ func (d DiggerController) SetJobStatusForProject(c *gin.Context) {
820834
}
821835
}
822836

837+
err = DeleteOlderPRCommentsIfEnabled(d.GithubClientProvider, batch)
838+
if err != nil {
839+
slog.Error("failed to delete older comments", "repoFullName", batch.RepoFullName, "prNumber", batch.PrNumber, "batchID", batch.ID, "error", err)
840+
}
841+
823842
// return batch summary to client
824843
res, err := batch.MapToJsonStruct()
825844
if err != nil {
@@ -1439,3 +1458,121 @@ func AutomergePRforBatchIfEnabled(gh utils.GithubClientProvider, batch *models.D
14391458

14401459
return nil
14411460
}
1461+
1462+
func DeleteOlderPRCommentsIfEnabled(gh utils.GithubClientProvider, batch *models.DiggerBatch) error {
1463+
slog.Info("Checking if PR should have prior comments deleted",
1464+
"batchId", batch.ID,
1465+
"prNumber", batch.PrNumber,
1466+
"batchStatus", batch.Status,
1467+
"batchType", batch.BatchType,
1468+
)
1469+
1470+
diggerYmlString := batch.DiggerConfig
1471+
diggerConfigYml, err := digger_config.LoadDiggerConfigYamlFromString(diggerYmlString)
1472+
if err != nil {
1473+
slog.Error("Error loading Digger config from batch",
1474+
"batchId", batch.ID,
1475+
"error", err,
1476+
)
1477+
return fmt.Errorf("error loading digger config from batch: %v", err)
1478+
}
1479+
1480+
config, _, err := digger_config.ConvertDiggerYamlToConfig(diggerConfigYml)
1481+
if err != nil {
1482+
slog.Error("Error converting Digger YAML to config",
1483+
"batchId", batch.ID,
1484+
"error", err,
1485+
)
1486+
return fmt.Errorf("error loading digger config from yaml: %v", err)
1487+
}
1488+
1489+
deleteOlderComments := config.DeletePriorComments
1490+
1491+
slog.Debug("Delete prior comments settings",
1492+
"enabled", deleteOlderComments,
1493+
"batchStatus", batch.Status,
1494+
"batchType", batch.BatchType,
1495+
)
1496+
1497+
if (batch.Status == orchestrator_scheduler.BatchJobSucceeded || batch.Status == orchestrator_scheduler.BatchJobFailed) &&
1498+
batch.BatchType == orchestrator_scheduler.DiggerCommandPlan &&
1499+
batch.CoverAllImpactedProjects == true &&
1500+
deleteOlderComments == true {
1501+
1502+
slog.Info("Conditions met for deleting prior comments, proceeding",
1503+
"batchId", batch.ID,
1504+
"prNumber", batch.PrNumber,
1505+
)
1506+
1507+
prService, err := GetPrServiceFromBatch(batch, gh)
1508+
if err != nil {
1509+
slog.Error("Error getting PR service",
1510+
"batchId", batch.ID,
1511+
"error", err,
1512+
)
1513+
return fmt.Errorf("error getting github service: %v", err)
1514+
}
1515+
1516+
prBatches, err := models.DB.GetDiggerBatchesForPR(batch.RepoFullName, batch.PrNumber)
1517+
if err != nil {
1518+
slog.Error("Error getting PR service",
1519+
"batchId", batch.ID,
1520+
"error", err,
1521+
)
1522+
return fmt.Errorf("error getting github service: %v", err)
1523+
}
1524+
1525+
for _, prBatch := range prBatches {
1526+
if prBatch.BatchType == orchestrator_scheduler.DiggerCommandApply {
1527+
slog.Info("found previous apply job for PR therefore not deleting earlier comments")
1528+
return nil
1529+
}
1530+
}
1531+
1532+
allDeletesSuccessful := true
1533+
for _, prBatch := range prBatches {
1534+
if prBatch.ID == batch.ID {
1535+
// don't delete the current batch comments
1536+
continue
1537+
}
1538+
jobs, err := models.DB.GetDiggerJobsForBatch(prBatch.ID)
1539+
if err != nil {
1540+
slog.Error("could not get jobs for batch", "batchId", prBatch.ID, "error", err)
1541+
// won't return error here since can still continue deleting rest of batches
1542+
continue
1543+
}
1544+
for _, prJob := range jobs {
1545+
if prJob.PRCommentId == nil {
1546+
slog.Debug("PR comment not found for job, ignoring deletion", "JobID", prJob.ID)
1547+
continue
1548+
}
1549+
// TODO: this delete will fail with 404 for all previous batches that already have been deleted
1550+
// for now its okay but maybe better approach is only considering the most recent or have a marker on each batch
1551+
// on whether or not its comments were deleted yet
1552+
err = prService.DeleteComment(strconv.FormatInt(*prJob.PRCommentId, 10))
1553+
if err != nil {
1554+
slog.Error("Could not delete comment for job", "jobID", prJob.ID, "commentID", prJob.PRCommentId, "error", err)
1555+
allDeletesSuccessful = false
1556+
}
1557+
}
1558+
}
1559+
1560+
if !allDeletesSuccessful {
1561+
slog.Warn("some of the previous comments failed to delete")
1562+
}
1563+
1564+
return nil
1565+
1566+
} else {
1567+
if batch.BatchType != orchestrator_scheduler.DiggerCommandPlan {
1568+
slog.Debug("Skipping deletion of prior comments - not an plan command",
1569+
"batchId", batch.ID,
1570+
"batchType", batch.BatchType,
1571+
)
1572+
} else if !deleteOlderComments {
1573+
slog.Debug("Skipping deletion of prior comments - not enabled in config", "batchId", batch.ID)
1574+
}
1575+
}
1576+
1577+
return nil
1578+
}

backend/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm
750750
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
751751
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
752752
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM=
753+
github.com/alecthomas/kong v0.7.1 h1:azoTh0IOfwlAX3qN9sHWTxACE2oV8Bg2gAwBsMwDQY4=
754+
github.com/alecthomas/kong v0.7.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=
753755
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
754756
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
755757
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=

backend/migrations/20250512172515.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Modify "digger_jobs" table
2+
ALTER TABLE "public"."digger_jobs" ADD COLUMN "pr_comment_id" bigint NULL;

backend/migrations/20250512213729.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Modify "digger_batches" table
2+
ALTER TABLE "public"."digger_batches" ADD COLUMN "created_at" timestamptz NULL, ADD COLUMN "updated_at" timestamptz NULL, ADD COLUMN "deleted_at" timestamptz NULL;
3+
-- Create index "idx_digger_batches_deleted_at" to table: "digger_batches"
4+
CREATE INDEX "idx_digger_batches_deleted_at" ON "public"."digger_batches" ("deleted_at");

backend/migrations/atlas.sum

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1:fdisQq5X2P2f4UyvwdQ2k7q9iqRSi02mm1ydhG0V0G8=
1+
h1:7qYia+JfrMJUdNvsjR8hZosttT36aVdOje5TP3ekX4w=
22
20231227132525.sql h1:43xn7XC0GoJsCnXIMczGXWis9d504FAWi4F1gViTIcw=
33
20240115170600.sql h1:IW8fF/8vc40+eWqP/xDK+R4K9jHJ9QBSGO6rN9LtfSA=
44
20240116123649.sql h1:R1JlUIgxxF6Cyob9HdtMqiKmx/BfnsctTl5rvOqssQw=
@@ -47,3 +47,5 @@ h1:fdisQq5X2P2f4UyvwdQ2k7q9iqRSi02mm1ydhG0V0G8=
4747
20250325115901.sql h1:yrha7g515WPkFRHfidvtLVWMeQmRD8rzVyWtPbuk0ws=
4848
20250325134924.sql h1:5vywDVuT0FPmQKP75AvxopxOeuKXsTEN00rgQjnA+ss=
4949
20250416152705.sql h1:yeszz4c/BlyVgUUIk7aTUz/DUNMC40+9fe1Q8Ya4TVI=
50+
20250512172515.sql h1:iIZIhFq3TTyjTzsxNWv3k4FcIkXfOCdHtmHNmYqjBMM=
51+
20250512213729.sql h1:n8bYIXWko9xOUs+FPcG7lS3GXMVQBSygXX7Hpj20eVs=

backend/models/scheduler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const DiggerVCSGitlab DiggerVCSType = "gitlab"
2424
const DiggerVCSBitbucket DiggerVCSType = "bitbucket"
2525

2626
type DiggerBatch struct {
27+
gorm.Model
2728
ID uuid.UUID `gorm:"primary_key"`
2829
VCS DiggerVCSType
2930
PrNumber int
@@ -53,6 +54,7 @@ type DiggerJob struct {
5354
Batch *DiggerBatch
5455
BatchID *string `gorm:"index:idx_digger_job_id"`
5556
PRCommentUrl string
57+
PRCommentId *int64
5658
DiggerJobSummary DiggerJobSummary
5759
DiggerJobSummaryID uint
5860
SerializedJobSpec []byte

backend/models/storage.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,3 +1839,24 @@ func (db *Database) GetRepoCache(orgId uint, repoFullName string) (*RepoCache, e
18391839
"configSize", len(repoCache.DiggerConfig))
18401840
return &repoCache, nil
18411841
}
1842+
1843+
func (db *Database) GetDiggerBatchesForPR(repoFullName string, prNumber int) ([]DiggerBatch, error) {
1844+
// Step 1: Get all batches for the PR
1845+
batches := make([]DiggerBatch, 0)
1846+
result := db.GormDB.Where("repo_full_name = ? AND pr_number = ?", repoFullName, prNumber).Find(&batches)
1847+
if result.Error != nil {
1848+
slog.Error("error fetching batches for PR",
1849+
"prNumber", prNumber,
1850+
"repoFullName", repoFullName,
1851+
"error", result.Error)
1852+
return nil, result.Error
1853+
}
1854+
slog.Info("fetched all digger batches for PR",
1855+
"prNumber", prNumber,
1856+
"repoFullName", repoFullName,
1857+
"batchCount", len(batches),
1858+
"jobCount", len(batches))
1859+
1860+
return batches, nil
1861+
1862+
}

cli/pkg/digger/digger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func RunJobs(jobs []orchestrator.Job, prService ci.PullRequestService, orgServic
131131
if allAppliesSuccess == true && reportFinalStatusToBackend == true {
132132
currentJob := jobs[0]
133133

134-
_, jobPrCommentUrl, err := reporter.Flush()
134+
jobPrCommentId, jobPrCommentUrl, err := reporter.Flush()
135135
if err != nil {
136136
slog.Error("error while sending job comments", "error", err)
137137
cmt, cmt_err := prService.PublishComment(*currentJob.PullRequestNumber, fmt.Sprintf(":yellow_circle: Warning: failed to post report for project %v, received error: %v.\n\n you may review details in the job logs", currentJob.ProjectName, err))
@@ -153,7 +153,7 @@ func RunJobs(jobs []orchestrator.Job, prService ci.PullRequestService, orgServic
153153
prNumber := *currentJob.PullRequestNumber
154154

155155
iacUtils := iac_utils.GetIacUtilsIacType(currentJob.IacType())
156-
batchResult, err := backendApi.ReportProjectJobStatus(currentJob.Namespace, projectNameForBackendReporting, jobId, "succeeded", time.Now(), &summary, "", jobPrCommentUrl, terraformOutput, iacUtils)
156+
batchResult, err := backendApi.ReportProjectJobStatus(currentJob.Namespace, projectNameForBackendReporting, jobId, "succeeded", time.Now(), &summary, "", jobPrCommentUrl, jobPrCommentId, terraformOutput, iacUtils)
157157
if err != nil {
158158
slog.Error("error reporting Job status", "error", err)
159159
return false, false, fmt.Errorf("error while running command: %v", err)

cli/pkg/digger/digger_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ func (m *MockPRManager) EditComment(prNumber int, id string, comment string) err
155155
return nil
156156
}
157157

158+
func (m *MockPRManager) DeleteComment(id string) error {
159+
return nil
160+
}
161+
158162
func (m *MockPRManager) CreateCommentReaction(id string, reaction string) error {
159163
m.Commands = append(m.Commands, RunInfo{"EditComment", id + " " + reaction, time.Now()})
160164
return nil

cli/pkg/spec/spec.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
func reportError(spec spec.Spec, backendApi backend2.Api, message string, err error) {
1919
slog.Error(message)
20-
_, reportingError := backendApi.ReportProjectJobStatus(spec.VCS.RepoName, spec.Job.ProjectName, spec.JobId, "failed", time.Now(), nil, "", "", "", nil)
20+
_, reportingError := backendApi.ReportProjectJobStatus(spec.VCS.RepoName, spec.Job.ProjectName, spec.JobId, "failed", time.Now(), nil, "", "", "", "", nil)
2121
if reportingError != nil {
2222
usage.ReportErrorAndExit(spec.VCS.RepoOwner, fmt.Sprintf("Failed to run commands. %v", err), 5)
2323
}
@@ -137,7 +137,7 @@ func RunSpec(
137137

138138
jobs := []scheduler.Job{job}
139139

140-
_, err = backendApi.ReportProjectJobStatus(spec.VCS.RepoName, spec.Job.ProjectName, spec.JobId, "started", time.Now(), nil, "", "", "", nil)
140+
_, err = backendApi.ReportProjectJobStatus(spec.VCS.RepoName, spec.Job.ProjectName, spec.JobId, "started", time.Now(), nil, "", "", "", "", nil)
141141
if err != nil {
142142
message := fmt.Sprintf("Failed to report jobSpec status to backend. Exiting. %v", err)
143143
reportError(spec, backendApi, message, err)
@@ -158,7 +158,7 @@ func RunSpec(
158158
reportTerraformOutput := spec.Reporter.ReportTerraformOutput
159159
allAppliesSuccess, _, err := digger.RunJobs(jobs, prService, orgService, lock, reporter, planStorage, policyChecker, commentUpdater, backendApi, spec.JobId, true, reportTerraformOutput, commentId, currentDir)
160160
if !allAppliesSuccess || err != nil {
161-
serializedBatch, reportingError := backendApi.ReportProjectJobStatus(spec.VCS.RepoName, spec.Job.ProjectName, spec.JobId, "failed", time.Now(), nil, "", "", "", nil)
161+
serializedBatch, reportingError := backendApi.ReportProjectJobStatus(spec.VCS.RepoName, spec.Job.ProjectName, spec.JobId, "failed", time.Now(), nil, "", "", "", "", nil)
162162
if reportingError != nil {
163163
message := fmt.Sprintf("Failed run commands. %v", err)
164164
reportError(spec, backendApi, message, err)

docs/ce/reference/digger.yml.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ workflows:
104104
| auto_merge | boolean | false | no | automatically merge pull requests when all checks pass | |
105105
| auto_merge_strategy | string | "squash" | no | The merge strategy to use while automerging, defaults to "squash". Possible values: 'squash', 'merge' (for merge commits) and 'rebase' | currently only github supported for this flag |
106106
| pr_locks | boolean | true | no | Enable PR-level locking | |
107+
| delete_prior_comments | boolean | false | no | Enables digger to delete previous comments to reduce noise in the PR | |
107108
| projects | array of [Projects](/ce/reference/digger.yml#project) | \[\] | no | list of projects to manage | |
108109
| generate_projects | [GenerateProjects](/ce/reference/digger.yml#generateprojects) | {} | no | generate projects from a directory structure | |
109110
| workflows | map of [Workflows](/ce/reference/digger.yml#workflows) | {} | no | workflows and configurations to run on events | |

libs/backendapi/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
type Api interface {
1010
ReportProject(repo string, projectName string, configuration string) error
1111
ReportProjectRun(repo string, projectName string, startedAt time.Time, endedAt time.Time, status string, command string, output string) error
12-
ReportProjectJobStatus(repo string, projectName string, jobId string, status string, timestamp time.Time, summary *iac_utils.IacSummary, planJson string, PrCommentUrl string, terraformOutput string, iacUtils iac_utils.IacUtils) (*scheduler.SerializedBatch, error)
12+
ReportProjectJobStatus(repo string, projectName string, jobId string, status string, timestamp time.Time, summary *iac_utils.IacSummary, planJson string, PrCommentUrl string, PrCommentId string, terraformOutput string, iacUtils iac_utils.IacUtils) (*scheduler.SerializedBatch, error)
1313
UploadJobArtefact(zipLocation string) (*int, *string, error)
1414
DownloadJobArtefact(downloadTo string) (*string, error)
1515
}

libs/backendapi/diggerapi.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (n NoopApi) ReportProjectRun(namespace string, projectName string, startedA
3131
return nil
3232
}
3333

34-
func (n NoopApi) ReportProjectJobStatus(repo string, projectName string, jobId string, status string, timestamp time.Time, summary *iac_utils.IacSummary, planJson string, PrCommentUrl string, terraformOutput string, iacUtils iac_utils.IacUtils) (*scheduler.SerializedBatch, error) {
34+
func (n NoopApi) ReportProjectJobStatus(repo string, projectName string, jobId string, status string, timestamp time.Time, summary *iac_utils.IacSummary, planJson string, PrCommentUrl string, PrCommentId string, terraformOutput string, iacUtils iac_utils.IacUtils) (*scheduler.SerializedBatch, error) {
3535
return nil, nil
3636
}
3737

@@ -135,8 +135,8 @@ func (d DiggerApi) ReportProjectRun(namespace string, projectName string, starte
135135
return nil
136136
}
137137

138-
func (d DiggerApi) ReportProjectJobStatus(repoFullName string, projectName string, jobId string, status string, timestamp time.Time, summary *iac_utils.IacSummary, planJson string, PrCommentUrl string, terraformOutput string, iacUtils iac_utils.IacUtils) (*scheduler.SerializedBatch, error) {
139-
repoNameForBackendReporting := strings.ReplaceAll(repoFullName, "/", "-")
138+
func (d DiggerApi) ReportProjectJobStatus(repo string, projectName string, jobId string, status string, timestamp time.Time, summary *iac_utils.IacSummary, planJson string, PrCommentUrl string, PrCommentId string, terraformOutput string, iacUtils iac_utils.IacUtils) (*scheduler.SerializedBatch, error) {
139+
repoNameForBackendReporting := strings.ReplaceAll(repo, "/", "-")
140140
u, err := url.Parse(d.DiggerHost)
141141
if err != nil {
142142
slog.Error("not able to parse digger cloud url", "error", err)
@@ -167,6 +167,7 @@ func (d DiggerApi) ReportProjectJobStatus(repoFullName string, projectName strin
167167
"job_summary": planSummaryJson,
168168
"job_plan_footprint": planFootprint.ToJson(),
169169
"pr_comment_url": PrCommentUrl,
170+
"pr_comment_id": PrCommentId,
170171
"terraform_output": terraformOutput,
171172
}
172173

0 commit comments

Comments
 (0)