webhook: add run creation trigger type

This commit is contained in:
Simone Gotti 2019-06-10 17:04:50 +02:00
parent 1938c2daaf
commit 5b22ebc2d3
2 changed files with 17 additions and 8 deletions

View File

@ -50,6 +50,8 @@ const (
AnnotationProjectID = "projectid"
AnnotationUserID = "userid"
AnnotationRunCreationTrigger = "run_creation_trigger"
AnnotationCommitSHA = "commit_sha"
AnnotationRef = "ref"
AnnotationSender = "sender"
@ -262,14 +264,15 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) {
refType := common.WebHookEventToRunRefType(webhookData.Event)
annotations := map[string]string{
AnnotationRunType: string(runType),
AnnotationRefType: string(refType),
AnnotationCommitSHA: webhookData.CommitSHA,
AnnotationRef: webhookData.Ref,
AnnotationSender: webhookData.Sender,
AnnotationMessage: webhookData.Message,
AnnotationCommitLink: webhookData.CommitLink,
AnnotationCompareLink: webhookData.CompareLink,
AnnotationRunType: string(runType),
AnnotationRefType: string(refType),
AnnotationRunCreationTrigger: string(types.RunCreationTriggerTypeWebhook),
AnnotationCommitSHA: webhookData.CommitSHA,
AnnotationRef: webhookData.Ref,
AnnotationSender: webhookData.Sender,
AnnotationMessage: webhookData.Message,
AnnotationCommitLink: webhookData.CommitLink,
AnnotationCompareLink: webhookData.CompareLink,
}
if runType == types.RunTypeProject {

View File

@ -28,3 +28,9 @@ const (
RunRefTypeTag RunRefType = "tag"
RunRefTypePullRequest RunRefType = "pull_request"
)
type RunCreationTriggerType string
const (
RunCreationTriggerTypeWebhook RunCreationTriggerType = "webhook"
)