Skip to content

Commit

Permalink
feat: github触发器事件补充 #9372
Browse files Browse the repository at this point in the history
  • Loading branch information
hejieehe committed Oct 25, 2023
1 parent a466435 commit 6103b43
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ data class GithubReviewCommentEvent(

data class GithubReviewComment(
override val id: Long,
override val url: String,
override val url: String?,
@JsonProperty("html_url")
override val htmlUrl: String,
override val htmlUrl: String?,
@JsonProperty("node_id")
override val nodeId: String,
override val body: String,
override val user: GithubUser,
@JsonProperty("created_at")
override val createdAt: String,
override val createdAt: String?,
@JsonProperty("updated_at")
override val updatedAt: String,
override val updatedAt: String?,
@ApiModelProperty("Github PR Review Id")
@JsonProperty("pull_request_review_id")
val pullRequestReviewId: Long,
Expand Down Expand Up @@ -163,7 +163,7 @@ abstract class GithubComment(
override val url: String?,
@JsonProperty("html_url")
@ApiModelProperty("评论链接[网页链接]")
override val htmlUrl: String,
override val htmlUrl: String?,
@JsonProperty("node_id")
override val nodeId: String,
@ApiModelProperty("评论内容")
Expand All @@ -190,7 +190,7 @@ open class GithubCommitComment(
override val id: Long,
override val url: String?,
@JsonProperty("html_url")
override val htmlUrl: String,
override val htmlUrl: String?,
@JsonProperty("node_id")
override val nodeId: String,
override val body: String,
Expand All @@ -216,17 +216,17 @@ open class GithubCommitComment(
@ApiModel("Github Issue 评论")
data class GithubIssueComment(
override val id: Long,
override val url: String,
override val url: String?,
@JsonProperty("html_url")
override val htmlUrl: String,
override val htmlUrl: String?,
@JsonProperty("node_id")
override val nodeId: String,
override val body: String,
override val user: GithubUser,
@JsonProperty("created_at")
override val createdAt: String,
override val createdAt: String?,
@JsonProperty("updated_at")
override val updatedAt: String,
override val updatedAt: String?,
@JsonProperty("issue_url")
@ApiModelProperty("评论链接[API链接]")
val issueUrl: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ data class GithubRepository(
// @JsonProperty("contributors_url")
// val contributorsUrl: String, // https://api.github.com/repos/yongyiduan/webhook-test/contributors
@JsonProperty("created_at")
override val createdAt: String, // 1655798261 or 2022-06-21T08:45:42Z github这两种类型都会传,难受~
override val createdAt: String?, // 1655798261 or 2022-06-21T08:45:42Z github这两种类型都会传,难受~
@JsonProperty("default_branch")
val defaultBranch: String, // main
// @JsonProperty("deployments_url")
Expand Down Expand Up @@ -300,7 +300,7 @@ data class GithubRepository(
// @JsonProperty("trees_url")
// val treesUrl: String, // https://api.github.com/repos/yongyiduan/webhook-test/git/trees{/sha}
@JsonProperty("updated_at")
override val updatedAt: String, // 2022-06-21T07:54:56Z
override val updatedAt: String?, // 2022-06-21T07:54:56Z
@JsonProperty("url")
override val url: String, // https://github.com/yongyiduan/webhook-test
@JsonProperty("visibility")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ data class GithubIssue(
override val url: String?,
@JsonProperty("html_url")
@ApiModelProperty("Issue/Pull Request链接[网页链接]")
override val htmlUrl: String,
override val htmlUrl: String?,
@ApiModelProperty("Issue ID")
override val id: Long,
@JsonProperty("node_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ class GithubIssueTriggerHandler : CodeWebhookTriggerHandler<GithubIssuesEvent> {
startParams[BK_REPO_GIT_WEBHOOK_ISSUE_DESCRIPTION] = body ?: ""
startParams[BK_REPO_GIT_WEBHOOK_ISSUE_STATE] = state
startParams[BK_REPO_GIT_WEBHOOK_ISSUE_OWNER] = user.login
startParams[BK_REPO_GIT_WEBHOOK_ISSUE_URL] = htmlUrl
startParams[BK_REPO_GIT_WEBHOOK_ISSUE_URL] = htmlUrl ?: ""
startParams[BK_REPO_GIT_WEBHOOK_ISSUE_MILESTONE_ID] = milestone?.id ?: ""
startParams[BK_REPO_GIT_WEBHOOK_ISSUE_ACTION] = event.action
startParams[PIPELINE_GIT_EVENT_URL] = htmlUrl
startParams[PIPELINE_GIT_EVENT_URL] = htmlUrl ?: ""
}
return startParams
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ class TGitMrTriggerHandler(
startParams[PIPELINE_GIT_EVENT_URL] = event.object_attributes.url ?: ""

// 有覆盖风险的上下文做二次确认
startParams.putIfEmpty(GIT_MR_NUMBER, event.object_attributes.iid.toString())
startParams.putIfEmpty(PIPELINE_GIT_MR_ID, event.object_attributes.id.toString())
startParams.putIfEmpty(PIPELINE_GIT_MR_URL, event.object_attributes.url ?: "")
startParams.putIfEmpty(PIPELINE_GIT_MR_IID, event.object_attributes.iid.toString())
Expand Down

0 comments on commit 6103b43

Please sign in to comment.