mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
41 lines
1.5 KiB
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package actions
|
|
|
|
import (
|
|
webhook_module "code.gitea.io/gitea/modules/webhook"
|
|
|
|
"github.com/nektos/act/pkg/jobparser"
|
|
)
|
|
|
|
const (
|
|
githubEventPullRequest = "pull_request"
|
|
githubEventPullRequestTarget = "pull_request_target"
|
|
githubEventPullRequestReviewComment = "pull_request_review_comment"
|
|
githubEventPullRequestReview = "pull_request_review"
|
|
githubEventRegistryPackage = "registry_package"
|
|
githubEventCreate = "create"
|
|
githubEventDelete = "delete"
|
|
githubEventFork = "fork"
|
|
githubEventPush = "push"
|
|
githubEventIssues = "issues"
|
|
githubEventIssueComment = "issue_comment"
|
|
githubEventRelease = "release"
|
|
githubEventPullRequestComment = "pull_request_comment"
|
|
)
|
|
|
|
func convertFromGithubEvent(evt *jobparser.Event) string {
|
|
switch evt.Name {
|
|
case githubEventPullRequest, githubEventPullRequestTarget, githubEventPullRequestReview,
|
|
githubEventPullRequestReviewComment:
|
|
return string(webhook_module.HookEventPullRequest)
|
|
case githubEventRegistryPackage:
|
|
return string(webhook_module.HookEventPackage)
|
|
case githubEventCreate, githubEventDelete, githubEventFork, githubEventPush,
|
|
githubEventIssues, githubEventIssueComment, githubEventRelease, githubEventPullRequestComment:
|
|
fallthrough
|
|
default:
|
|
return evt.Name
|
|
}
|
|
}
|
|
|