webhook: remove annotation virtual branch
This commit is contained in:
parent
863277af2d
commit
38b54b092c
|
@ -49,8 +49,6 @@ const (
|
|||
AnnotationRunType = "runtype"
|
||||
AnnotationProjectID = "projectid"
|
||||
AnnotationUserID = "userid"
|
||||
// AnnotationVirtualBranch represent a "virtual branch": i.e a normal branch, a pr (with name pr-$prid), a tag (with name tag-tagname)
|
||||
AnnotationVirtualBranch = "virtual_branch"
|
||||
|
||||
AnnotationCommitSHA = "commit_sha"
|
||||
AnnotationRef = "ref"
|
||||
|
@ -67,19 +65,6 @@ const (
|
|||
AnnotationPullRequestLink = "pull_request_link"
|
||||
)
|
||||
|
||||
func genAnnotationVirtualBranch(webhookData *types.WebhookData) string {
|
||||
switch webhookData.Event {
|
||||
case types.WebhookEventPush:
|
||||
return "branch-" + webhookData.Branch
|
||||
case types.WebhookEventTag:
|
||||
return "tag-" + webhookData.Tag
|
||||
case types.WebhookEventPullRequest:
|
||||
return "pr-" + webhookData.PullRequestID
|
||||
}
|
||||
|
||||
panic(fmt.Errorf("invalid webhook event type: %q", webhookData.Event))
|
||||
}
|
||||
|
||||
type webhooksHandler struct {
|
||||
log *zap.SugaredLogger
|
||||
ah *action.ActionHandler
|
||||
|
@ -276,7 +261,6 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) {
|
|||
annotations := map[string]string{
|
||||
AnnotationRunType: string(runType),
|
||||
AnnotationEventType: string(webhookData.Event),
|
||||
AnnotationVirtualBranch: genAnnotationVirtualBranch(webhookData),
|
||||
AnnotationCommitSHA: webhookData.CommitSHA,
|
||||
AnnotationRef: webhookData.Ref,
|
||||
AnnotationSender: webhookData.Sender,
|
||||
|
|
Loading…
Reference in New Issue