File tree Expand file tree Collapse file tree
src/main/kotlin/com/project/codereview/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ data class InstallationPayload(
2020@JsonIgnoreProperties(ignoreUnknown = true )
2121data class PullRequestPayload (
2222 val url : String ,
23- val head : PullRequestHeadPayload
23+ val head : PullRequestHeadPayload ,
24+ val base : BasePayload
2425) {
2526 private val _urls = url.removePrefix(" https://" ).split(" /" )
2627 val owner = _urls [2 ]
@@ -30,7 +31,18 @@ data class PullRequestPayload(
3031
3132@JsonIgnoreProperties(ignoreUnknown = true )
3233data class PullRequestHeadPayload (
33- val sha : String
34+ val sha : String ,
35+ val repo : RepositoryPayload
36+ )
37+
38+ @JsonIgnoreProperties(ignoreUnknown = true )
39+ data class RepositoryPayload (
40+ val default_branch : String
41+ )
42+
43+ @JsonIgnoreProperties(ignoreUnknown = true )
44+ data class BasePayload (
45+ val ref : String
3446)
3547
3648val mapper = jacksonObjectMapper()
Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ class PullRequestEventEntry(
2424 return
2525 }
2626
27+ val repositoryDefaultBranch = payload.pull_request.head.repo.default_branch
28+ val targetRefBranch = payload.pull_request.base.ref
29+ if (repositoryDefaultBranch == targetRefBranch) {
30+ logger.debug(" Do not review default branch: {}" , " $repositoryDefaultBranch to $targetRefBranch " )
31+ return
32+ }
33+
2734 val action = GithubActionType .Companion (payload.action)
2835 val pr = payload.pull_request
2936 val diff = githubDiffClient.getPrDiff(pr.owner, pr.repo, pr.prNumber)
You can’t perform that action at this time.
0 commit comments