Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: github触发器事件补充 #9372 #9481

Merged
merged 28 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f29fe62
feat: github触发器事件补充 #9372
hejieehe Aug 30, 2023
fdbc590
feat: github触发器事件补充 #9372
hejieehe Aug 31, 2023
24cc5ce
feat: github触发器事件补充 #9372
hejieehe Sep 1, 2023
3921e82
feat: github触发器事件补充 #9372
hejieehe Sep 1, 2023
c29b010
feat: github触发器事件补充 #9372
hejieehe Sep 1, 2023
febcfb9
feat: github触发器事件补充 #9372
hejieehe Sep 4, 2023
d167fb0
feat: github触发器事件补充 #9372
hejieehe Sep 4, 2023
a846c24
feat: github触发器事件补充 #9372
hejieehe Sep 4, 2023
98196e6
feat: github触发器事件补充 #9372
hejieehe Sep 5, 2023
66e947d
feat: github触发器事件补充 #9372
hejieehe Sep 5, 2023
f67c6d0
feat: github触发器事件补充 #9372
hejieehe Sep 5, 2023
a1e08e5
feat: github触发器事件补充 #9372
hejieehe Sep 5, 2023
aa9df2f
Merge branch 'feat_9372' of https://github.com/hejieehe/bk-ci into fe…
hejieehe Sep 5, 2023
82b1010
feat: github触发器事件补充 #9372
hejieehe Sep 5, 2023
4f52088
feat: github触发器事件补充 #9372
hejieehe Sep 18, 2023
1bc7f70
feat: github触发器事件补充 #9372
hejieehe Sep 18, 2023
4551d13
feat: github触发器事件补充 #9372
hejieehe Sep 18, 2023
51467c5
feat: github触发器事件补充 #9372
hejieehe Sep 18, 2023
0fa2e80
feat: github触发器事件补充 #9372
hejieehe Sep 18, 2023
1501b27
feat: github触发器事件补充 #9372
hejieehe Sep 21, 2023
b1a4891
feat: github触发器事件补充 #9372
hejieehe Oct 8, 2023
9ce7d3f
feat: github触发器事件补充 #9372
hejieehe Oct 9, 2023
fd76a3b
feat: github触发器事件补充 #9372
hejieehe Oct 11, 2023
af2fe1a
feat: github触发器事件补充 #9372
hejieehe Oct 11, 2023
e41acf8
Merge remote-tracking branch 'github/master' into feat_9372
hejieehe Oct 16, 2023
24bf1c1
【PAC】feat:代码库支持重置授权 #8145
hejieehe Oct 16, 2023
a466435
feat: github触发器事件补充 #9372
hejieehe Oct 17, 2023
6103b43
feat: github触发器事件补充 #9372
hejieehe Oct 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ data class CodeGithubWebHookTriggerElement(
@ApiModelProperty("新版的github原子的类型")
val repositoryType: RepositoryType? = null,
@ApiModelProperty("新版的github代码库名")
val repositoryName: String? = null
val repositoryName: String? = null,
@ApiModelProperty("code review 状态", required = false)
val includeCrState: List<String>? = null,
@ApiModelProperty("code note comment", required = false)
val includeNoteComment: String? = null,
@ApiModelProperty("code note 类型", required = false)
val includeNoteTypes: List<String>? = null,
@ApiModelProperty("issue事件action")
val includeIssueAction: List<String>? = null
) : WebHookTriggerElement(name, id, status) {
companion object {
const val classType = "codeGithubWebHookTrigger"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const val BK_REPO_GIT_WEBHOOK_EXCLUDE_BRANCHS = "BK_CI_REPO_GIT_WEBHOOK_EXCLUDE_
const val BK_REPO_GIT_WEBHOOK_INCLUDE_PATHS = "BK_CI_REPO_GIT_WEBHOOK_INCLUDE_PATHS"
const val BK_REPO_GIT_WEBHOOK_EXCLUDE_PATHS = "BK_CI_REPO_GIT_WEBHOOK_EXCLUDE_PATHS"
const val BK_REPO_GIT_WEBHOOK_EXCLUDE_USERS = "BK_CI_REPO_GIT_WEBHOOK_EXCLUDE_USERS"
const val BK_REPO_GIT_WEBHOOK_INCLUDE_USERS = "BK_CI_REPO_GIT_WEBHOOK_INCLUDE_USERS"
const val BK_REPO_GIT_WEBHOOK_BRANCH = "BK_CI_REPO_GIT_WEBHOOK_BRANCH"
const val BK_REPO_GIT_MANUAL_UNLOCK = "BK_CI_REPO_GIT_MANUAL_UNLOCK"
const val BK_REPO_GIT_WEBHOOK_ENABLE_CHECK = "BK_REPO_GIT_WEBHOOK_ENABLE_CHECK"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license.
*
* A copy of the MIT License is included in this file.
*
*
* Terms of the MIT License:
* ---------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.tencent.devops.common.webhook.pojo.code.github

import com.fasterxml.jackson.annotation.JsonProperty
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty

@ApiModel("Github 基础信息")
open class GithubBaseInfo(
@ApiModelProperty("ID")
open val id: Long,
@ApiModelProperty("链接[API链接]")
open val url: String? = "",
@JsonProperty("html_url")
@ApiModelProperty("链接[网页链接]")
open val htmlUrl: String? = "",
@JsonProperty("node_id")
open val nodeId: String,
@JsonProperty("created_at")
open val createdAt: String? = "", // 2022-06-21T08:45:41Z
@JsonProperty("updated_at")
open val updatedAt: String? = ""
) {
companion object {
// github主页地址
const val GITHUB_HOME_PAGE_URL = "https://github.com"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license.
*
* A copy of the MIT License is included in this file.
*
*
* Terms of the MIT License:
* ---------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.tencent.devops.common.webhook.pojo.code.github

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty

/**
* Github 评论分四种:
* 1. PR Review 评论
* 1.1 基于PR直接评论
* 1.2 基于PR Review的会话进行评论
* 2. Issues 评论
* 3. Commit 评论
*/
@JsonIgnoreProperties(ignoreUnknown = true)
abstract class GithubCommentEvent(
open val action: String,
open val repository: GithubRepository,
open val comment: GithubComment,
override val sender: GithubUser
) : GithubEvent(sender) {
open fun getCommentType(): String = ""
}

@JsonIgnoreProperties(ignoreUnknown = true)
data class GithubCommitCommentEvent(
override val action: String,
override val repository: GithubRepository,
override val comment: GithubCommitComment,
override val sender: GithubUser
) : GithubCommentEvent(
action = action,
repository = repository,
comment = comment,
sender = sender
) {
companion object {
const val classType = "commit_comment"

// 评论类型:基于Commit进行评论
const val commentType = "Commit"
}

override fun getCommentType() = commentType
}

@ApiModel("Github Review 评论事件")
data class GithubReviewCommentEvent(
override val action: String,
@JsonProperty("pull_request")
@ApiModelProperty("Issues相关信息")
val pullRequest: GithubPullRequest,
@ApiModelProperty("Github仓库相关信息")
override val repository: GithubRepository,
@ApiModelProperty("操作人信息")
override val sender: GithubUser,
@ApiModelProperty("Review会话信息")
override val comment: GithubReviewComment
) : GithubCommentEvent(
action = action,
repository = repository,
comment = comment,
sender = sender
) {
companion object {
const val classType = "pull_request_review_comment"

// 评论类型:基于Pull Request Review进行评论
const val commentType = "Review"
}

override fun getCommentType() = commentType
}

data class GithubReviewComment(
override val id: Long,
override val url: String?,
@JsonProperty("html_url")
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?,
@JsonProperty("updated_at")
override val updatedAt: String?,
@ApiModelProperty("Github PR Review Id")
@JsonProperty("pull_request_review_id")
val pullRequestReviewId: Long,
@ApiModelProperty("Github PR Review会话对应的文件")
val path: String
) : GithubComment(
id = id,
url = url,
htmlUrl = htmlUrl,
nodeId = nodeId,
body = body,
user = user,
createdAt = createdAt,
updatedAt = updatedAt
)

@JsonIgnoreProperties(ignoreUnknown = true)
data class GithubIssueCommentEvent(
override val action: String,
override val repository: GithubRepository,
override val comment: GithubIssueComment,
override val sender: GithubUser,
val issue: GithubIssue
) : GithubCommentEvent(
action = action,
repository = repository,
comment = comment,
sender = sender
) {
companion object {
const val classType = "issue_comment"
}

override fun getCommentType() = if (issue.pullRequest != null) {
// 对齐Code_Git直接在PR上评论则[noteableType=Review]
"Review"
} else {
"Issue"
}
}

@Suppress("LongParameterList")
@ApiModel("Github 评论信息父类")
abstract class GithubComment(
@ApiModelProperty("评论ID")
override val id: Long,
@ApiModelProperty("评论链接[API链接]")
override val url: String?,
@JsonProperty("html_url")
@ApiModelProperty("评论链接[网页链接]")
override val htmlUrl: String?,
@JsonProperty("node_id")
override val nodeId: String,
@ApiModelProperty("评论内容")
open val body: String,
@ApiModelProperty("评论的用户")
open val user: GithubUser,
@JsonProperty("created_at")
@ApiModelProperty("创建时间")
override val createdAt: String?, // 2022-06-21T08:45:41Z
@JsonProperty("updated_at")
@ApiModelProperty("修改时间")
override val updatedAt: String? // 2022-06-21T08:45:41Z
) : GithubBaseInfo(
id = id,
url = url,
htmlUrl = htmlUrl,
nodeId = nodeId,
updatedAt = updatedAt,
createdAt = createdAt
)

@SuppressWarnings("LongParameterList")
open class GithubCommitComment(
override val id: Long,
override val url: String?,
@JsonProperty("html_url")
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?,
@JsonProperty("updated_at")
override val updatedAt: String?,
@JsonProperty("commit_id")
@ApiModelProperty("commit sha")
val commitId: String
) : GithubComment(
id = id,
url = url,
htmlUrl = htmlUrl,
nodeId = nodeId,
body = body,
user = user,
createdAt = createdAt,
updatedAt = updatedAt
)

@ApiModel("Github Issue 评论")
data class GithubIssueComment(
override val id: Long,
override val url: String?,
@JsonProperty("html_url")
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?,
@JsonProperty("updated_at")
override val updatedAt: String?,
@JsonProperty("issue_url")
@ApiModelProperty("评论链接[API链接]")
val issueUrl: String
) : GithubComment(
id = id,
url = url,
htmlUrl = htmlUrl,
nodeId = nodeId,
body = body,
user = user,
createdAt = createdAt,
updatedAt = updatedAt
)
Loading
Loading