feat(github): add github support
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-08-09 15:44:31 +02:00
parent 65fba21285
commit 89c1c72d87
11 changed files with 452 additions and 24 deletions

View File

@@ -1,8 +1,10 @@
package models
const (
MessageTypeRefreshRepository = "refresh_repository"
MessageTypeRefreshRepositoryDone = "refresh_repository_done"
MessageTypeRefreshGiteaRepository = "refresh_gitea_repository"
MessageTypeRefreshGiteaRepositoryDone = "refresh_gitea_repository_done"
MessageTypeRefreshGitHubRepository = "refresh_github_repository"
MessageTypeRefreshGitHubRepositoryDone = "refresh_github_repository_done"
)
type CreateHook struct {
@@ -14,7 +16,7 @@ type CreateHook struct {
Type string `json:"type"`
}
type RefreshRepositoryRequest struct {
type RefreshGiteaRepositoryRequest struct {
Repository string `json:"repository"`
Owner string `json:"owner"`
PullRequestID int `json:"pullRequestId"`
@@ -23,7 +25,27 @@ type RefreshRepositoryRequest struct {
ReportProgress bool `json:"reportProgress"`
}
type RefreshDoneRepositoryRequest struct {
type RefreshGiteaRepositoryDoneRequest struct {
Repository string `json:"repository"`
Owner string `json:"owner"`
PullRequestID int `json:"pullRequestId"`
CommentID int `json:"commentId"`
CommentBody string `json:"commentBody"`
ReportProgress bool `json:"reportProgress"`
Status string `json:"status"`
Error string `json:"error"`
}
type RefreshGitHubRepositoryRequest struct {
Repository string `json:"repository"`
Owner string `json:"owner"`
PullRequestID int `json:"pullRequestId"`
CommentID int `json:"commentId"`
CommentBody string `json:"commentBody"`
ReportProgress bool `json:"reportProgress"`
}
type RefreshGitHubRepositoryDoneRequest struct {
Repository string `json:"repository"`
Owner string `json:"owner"`
PullRequestID int `json:"pullRequestId"`
@@ -38,3 +60,10 @@ type AddCommentResponse struct {
Body string `json:"body"`
ID int `json:"id"`
}
type SupportedBackend string
const (
SupportedBackendGitHub SupportedBackend = "github"
SupportedBackendGitea SupportedBackend = "gitea"
)