Skip to content

Commit

Permalink
Merge pull request #6433 from yongyiduan/issue_6432
Browse files Browse the repository at this point in the history
feat: 监听非当前仓库hook事件 #6432
  • Loading branch information
irwinsun authored Mar 29, 2022
2 parents 10dc04c + 7e7eeef commit 46fe986
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,9 @@ data class GitChangeFileInfo(

fun GitEvent.isDeleteEvent() = (this is GitPushEvent && this.isDeleteBranch()) ||
(this is GitTagPushEvent && this.isDeleteTag())

fun GitEvent.isMrMergeEvent() = this is GitMergeRequestEvent && this.isMrMergeEvent()

fun GitEvent.isMrForkEvent() = this is GitMergeRequestEvent && this.isMrForkEvent()

fun GitEvent.isMrForkNotMergeEvent() = !this.isMrMergeEvent() && this.isMrForkEvent()
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ package com.tencent.devops.common.webhook.pojo.code.git

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.tencent.devops.common.webhook.enums.code.tgit.TGitMergeActionKind

@Suppress("ALL")
data class GitMergeRequestEvent(
Expand Down Expand Up @@ -69,3 +70,8 @@ data class GitMRAttributes(
@JsonProperty("merge_commit_sha")
val mergeCommitSha: String? = null
)

fun GitMergeRequestEvent.isMrMergeEvent() = this.object_attributes.action == TGitMergeActionKind.MERGE.value

fun GitMergeRequestEvent.isMrForkEvent() =
this.object_attributes.target_project_id != this.object_attributes.source_project_id

0 comments on commit 46fe986

Please sign in to comment.