Skip to content

Commit ea07fa6

Browse files
vulkoingimcsweichel
authored andcommitted
Only compare annotations on edit
1 parent 8922500 commit ea07fa6

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

plugins/github-integration/main.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,22 @@ func (p *githubTriggerPlugin) processPullRequestEditedEvent(ctx context.Context,
296296
pr := event.PullRequest
297297
// Potentially (depending on the webhook configuration) we'll get multiple PR events - when pushing (every push generates a "synchronize" pull_request event if there's a PR open),
298298
// adding/removing a label,reviewer, assigning/unassigning, etc. The only time annotations are relevant are when a PRs description is edited (opening a PR is handled by a different flow)
299+
prAnnotations := repo.ParseAnnotations(pr.GetBody())
299300
switch event.GetAction() {
300301
case "edited":
301302
if event.GetChanges() == nil || event.GetChanges().Body == nil {
302303
return
303304
}
305+
oldAnnotations := repo.ParseAnnotations(*event.GetChanges().Body.From)
306+
// the annotations didn't change between the PR edits - there's nothing to do
307+
if mapEQ(oldAnnotations, prAnnotations) {
308+
return
309+
}
304310
case "opened":
305311
default:
306312
return
307313
}
308314

309-
oldAnnotations := repo.ParseAnnotations(*event.GetChanges().Body.From)
310-
prAnnotations := repo.ParseAnnotations(pr.GetBody())
311-
// the annotations didn't change between the PR edits - there's nothing to do
312-
if mapEQ(oldAnnotations, prAnnotations) {
313-
return
314-
}
315-
316315
hasStatusUpdateAnnotation := len(prAnnotations) > 0 && prAnnotations[annotationStatusUpdate] != ""
317316

318317
ref := pr.GetHead().GetRef()

0 commit comments

Comments
 (0)