-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert GitHub event on actions and fix some pull_request events. (#2…
…3037) (#23471) Backport #23037 by @lunny Follow #22680 Partially Fix #22958, on pull_request, `opened`, `reopened`, `synchronize` supported, `edited` hasn't been supported yet because Gitea doesn't trigger that events. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: yp05327 <576951401@qq.com>
- Loading branch information
1 parent
28af02e
commit 31efbaf
Showing
2 changed files
with
212 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters