refactor(forge): drop ParseWebhook; forge webhooks arrive through archie's event capture (archie #1817)
publish / publish (push) Failing after 1s
publish / publish (push) Failing after 1s
This commit is contained in:
9 files changed
+64
-1272
No files matched your search
@@ -1,194 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/samcharles93/archipelago/sdk/forge"
|
||||
)
|
||||
|
||||
// ParseWebhook decodes a delivery the host has authenticated: the receiver
|
||||
// verifies the HMAC signature (X-Hub-Signature-256, which Gitea also sends, or
|
||||
// X-Gitea-Signature) before this runs, so the body is never parsed before
|
||||
// verification. Events the host does not act on (push, ping, ...) decode to
|
||||
// no event.
|
||||
func (c *GiteaClient) ParseWebhook(headers map[string]string, body []byte) (forge.WebhookEvent, error) {
|
||||
switch headers[http.CanonicalHeaderKey("X-Gitea-Event")] {
|
||||
case "issues":
|
||||
var p issuePayload
|
||||
if err := json.Unmarshal(body, &p); err != nil {
|
||||
return forge.WebhookEvent{}, fmt.Errorf("%w: %w", forge.ErrBadWebhook, err)
|
||||
}
|
||||
return forge.WebhookEvent{Issue: giteaIssueEvent(&p)}, nil
|
||||
case "pull_request_review", "pull_request_review_approved", "pull_request_review_rejected", "pull_request_review_comment":
|
||||
var p prReviewPayload
|
||||
if err := json.Unmarshal(body, &p); err != nil {
|
||||
return forge.WebhookEvent{}, fmt.Errorf("%w: %w", forge.ErrBadWebhook, err)
|
||||
}
|
||||
if p.Review == nil {
|
||||
return forge.WebhookEvent{}, nil
|
||||
}
|
||||
return forge.WebhookEvent{Review: giteaReviewEvent(headers[http.CanonicalHeaderKey("X-Gitea-Event")], &p)}, nil
|
||||
}
|
||||
return forge.WebhookEvent{}, nil
|
||||
}
|
||||
|
||||
// giteaIssueAction maps Gitea's issue actions onto the action vocabulary the
|
||||
// host's dispatch predicate understands (GitHub's). Gitea calls label changes
|
||||
// label_updated/label_cleared; older releases called them labeled/unlabeled.
|
||||
func giteaIssueAction(action string) string {
|
||||
switch action {
|
||||
case "label_updated", "labeled":
|
||||
return "labeled"
|
||||
case "label_cleared", "unlabeled":
|
||||
return "unlabeled"
|
||||
default:
|
||||
return action
|
||||
}
|
||||
}
|
||||
|
||||
func giteaIssueEvent(p *issuePayload) *forge.IssueEvent {
|
||||
if p.Issue == nil {
|
||||
return &forge.IssueEvent{Action: giteaIssueAction(p.Action)}
|
||||
}
|
||||
number := p.Issue.Number
|
||||
if number == 0 {
|
||||
number = p.Number
|
||||
}
|
||||
var labels []string
|
||||
for _, l := range p.Issue.Labels {
|
||||
if l.Name != "" {
|
||||
labels = append(labels, l.Name)
|
||||
}
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
var assignees []string
|
||||
users := append([]webhookUser{}, p.Issue.Assignees...)
|
||||
if p.Issue.Assignee != nil {
|
||||
users = append(users, *p.Issue.Assignee)
|
||||
}
|
||||
for _, u := range users {
|
||||
if u.Login != "" && !seen[u.Login] {
|
||||
seen[u.Login] = true
|
||||
assignees = append(assignees, u.Login)
|
||||
}
|
||||
}
|
||||
e := &forge.IssueEvent{
|
||||
Action: giteaIssueAction(p.Action),
|
||||
State: p.Issue.State,
|
||||
PullRequest: p.Issue.PullRequest != nil,
|
||||
Number: number,
|
||||
Title: p.Issue.Title,
|
||||
Body: p.Issue.Body,
|
||||
Labels: labels,
|
||||
Assignees: assignees,
|
||||
}
|
||||
if p.Repository != nil {
|
||||
e.Owner = p.Repository.Owner.Login
|
||||
e.Repo = p.Repository.Name
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
// giteaReviewEvent maps a pull request review delivery onto the neutral review
|
||||
// event. Recent Gitea versions send one event per verdict
|
||||
// (pull_request_review_approved/rejected/comment) with a thin review object
|
||||
// ({type, content}); the legacy pull_request_review event carries the full
|
||||
// review ({id, user, state, body}), so both fields are read.
|
||||
func giteaReviewEvent(event string, p *prReviewPayload) *forge.ReviewEvent {
|
||||
e := &forge.ReviewEvent{
|
||||
Action: "submitted", // a review delivery is always a submission
|
||||
State: giteaReviewState(event, p.Review),
|
||||
Body: p.Review.Content,
|
||||
}
|
||||
if e.Body == "" {
|
||||
e.Body = p.Review.Body
|
||||
}
|
||||
if p.Review.User != nil && p.Review.User.Login != "" {
|
||||
e.Author = p.Review.User.Login
|
||||
} else if p.Sender != nil {
|
||||
e.Author = p.Sender.Login
|
||||
}
|
||||
e.ReviewID = p.Review.ID
|
||||
number := p.Number
|
||||
if number == 0 && p.PullRequest != nil {
|
||||
number = p.PullRequest.Number
|
||||
}
|
||||
e.PRNumber = number
|
||||
if p.Repository != nil {
|
||||
e.Owner = p.Repository.Owner.Login
|
||||
e.Repo = p.Repository.Name
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
func giteaReviewState(event string, r *reviewPayload) string {
|
||||
switch event {
|
||||
case "pull_request_review_approved":
|
||||
return forge.ReviewStateApproved
|
||||
case "pull_request_review_rejected":
|
||||
return forge.ReviewStateRequestedChanges
|
||||
case "pull_request_review_comment":
|
||||
return forge.ReviewStateCommented
|
||||
default: // legacy pull_request_review: the payload carries the state
|
||||
return normalizeGiteaReviewState(gitea.ReviewStateType(r.State))
|
||||
}
|
||||
}
|
||||
|
||||
// ── webhook payload shapes (Gitea's api.* webhook payloads, trimmed to the
|
||||
// fields archie reads) ──────────────────────────────────────────────────
|
||||
|
||||
type webhookUser struct {
|
||||
Login string `json:"login"`
|
||||
}
|
||||
|
||||
type webhookLabel struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type webhookIssue struct {
|
||||
Number int `json:"number"`
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
State string `json:"state"`
|
||||
Labels []webhookLabel `json:"labels"`
|
||||
Assignee *webhookUser `json:"assignee"`
|
||||
Assignees []webhookUser `json:"assignees"`
|
||||
PullRequest *struct{} `json:"pull_request"`
|
||||
}
|
||||
|
||||
type webhookRepository struct {
|
||||
Name string `json:"name"`
|
||||
Owner webhookUser `json:"owner"`
|
||||
}
|
||||
|
||||
type issuePayload struct {
|
||||
Action string `json:"action"`
|
||||
Number int `json:"number"`
|
||||
Issue *webhookIssue `json:"issue"`
|
||||
Repository *webhookRepository `json:"repository"`
|
||||
Sender *webhookUser `json:"sender"`
|
||||
}
|
||||
|
||||
type reviewPayload struct {
|
||||
ID int64 `json:"id"`
|
||||
User *webhookUser `json:"user"`
|
||||
State string `json:"state"`
|
||||
Body string `json:"body"`
|
||||
Type string `json:"type"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type prReviewPayload struct {
|
||||
Action string `json:"action"`
|
||||
Number int `json:"number"`
|
||||
PullRequest *struct {
|
||||
Number int `json:"number"`
|
||||
} `json:"pull_request"`
|
||||
Repository *webhookRepository `json:"repository"`
|
||||
Sender *webhookUser `json:"sender"`
|
||||
Review *reviewPayload `json:"review"`
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archipelago/sdk/forge"
|
||||
)
|
||||
|
||||
// testSecret stands in for the webhook secret the host is configured with.
|
||||
const testSecret = "gitea-webhook-test-secret"
|
||||
|
||||
// signDelivery returns the signature headers Gitea sends for body: the plain
|
||||
// hex HMAC-SHA256 in X-Gitea-Signature and the same digest as "sha256=<hex>"
|
||||
// in X-Hub-Signature-256.
|
||||
func signDelivery(body []byte) map[string]string {
|
||||
mac := hmac.New(sha256.New, []byte(testSecret))
|
||||
mac.Write(body)
|
||||
sig := hex.EncodeToString(mac.Sum(nil))
|
||||
return map[string]string{
|
||||
"X-Hub-Signature-256": "sha256=" + sig,
|
||||
"X-Gitea-Signature": sig,
|
||||
}
|
||||
}
|
||||
|
||||
// verifyDelivery mirrors the host receiver's HMAC gate
|
||||
// (archie-core internal/webhookguard.VerifyHMAC, which the receiver applies to
|
||||
// X-Hub-Signature-256 before any parsing): hex SHA-256 HMAC of the body, the
|
||||
// "sha256=" prefix optional, constant-time comparison, empty never verifies.
|
||||
// The parser must only ever run behind this check.
|
||||
func verifyDelivery(body []byte, headers map[string]string) bool {
|
||||
sig := headers["X-Hub-Signature-256"]
|
||||
if sig == "" {
|
||||
return false
|
||||
}
|
||||
supplied, err := hex.DecodeString(strings.TrimPrefix(sig, "sha256="))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
mac := hmac.New(sha256.New, []byte(testSecret))
|
||||
mac.Write(body)
|
||||
return hmac.Equal(supplied, mac.Sum(nil))
|
||||
}
|
||||
|
||||
const issuesOpenedBody = `{
|
||||
"action": "opened",
|
||||
"number": 7,
|
||||
"issue": {
|
||||
"id": 101,
|
||||
"number": 7,
|
||||
"title": "Fix the flaky gate",
|
||||
"body": "It fails on retry",
|
||||
"state": "open",
|
||||
"user": {"login": "alice"},
|
||||
"labels": [{"id": 1, "name": "archie:queued"}, {"id": 2, "name": "bug"}],
|
||||
"assignee": {"login": "archie-bot"},
|
||||
"assignees": [{"login": "archie-bot"}, {"login": "alice"}],
|
||||
"pull_request": null
|
||||
},
|
||||
"repository": {"id": 5, "name": "repo", "full_name": "sam/repo", "owner": {"login": "sam"}},
|
||||
"sender": {"login": "alice"}
|
||||
}`
|
||||
|
||||
const issuesLabelUpdatedBody = `{
|
||||
"action": "label_updated",
|
||||
"number": 7,
|
||||
"issue": {
|
||||
"number": 7,
|
||||
"title": "Fix the flaky gate",
|
||||
"body": "It fails on retry",
|
||||
"state": "open",
|
||||
"labels": [{"id": 1, "name": "archie:queued"}],
|
||||
"assignee": {"login": "archie-bot"},
|
||||
"assignees": [{"login": "archie-bot"}],
|
||||
"pull_request": null
|
||||
},
|
||||
"repository": {"name": "repo", "owner": {"login": "sam"}},
|
||||
"sender": {"login": "alice"}
|
||||
}`
|
||||
|
||||
const reviewApprovedBody = `{
|
||||
"action": "reviewed",
|
||||
"number": 12,
|
||||
"pull_request": {"number": 12, "title": "Add the parser"},
|
||||
"repository": {"name": "repo", "owner": {"login": "sam"}},
|
||||
"sender": {"login": "alice"},
|
||||
"review": {"type": "pull_request_review_approved", "content": "lgtm"}
|
||||
}`
|
||||
|
||||
const reviewRejectedBody = `{
|
||||
"action": "reviewed",
|
||||
"number": 12,
|
||||
"pull_request": {"number": 12},
|
||||
"repository": {"name": "repo", "owner": {"login": "sam"}},
|
||||
"sender": {"login": "bob"},
|
||||
"review": {"type": "pull_request_review_rejected", "content": "please fix the tests"}
|
||||
}`
|
||||
|
||||
// legacyReviewBody is the pre-1.22 pull_request_review shape: one event, full
|
||||
// review object carrying id, user, state and body.
|
||||
const legacyReviewBody = `{
|
||||
"action": "reviewed",
|
||||
"number": 12,
|
||||
"pull_request": {"number": 12},
|
||||
"repository": {"name": "repo", "owner": {"login": "sam"}},
|
||||
"sender": {"login": "alice"},
|
||||
"review": {"id": 99, "user": {"login": "alice"}, "state": "REQUEST_CHANGES", "body": "needs work"}
|
||||
}`
|
||||
|
||||
const pushBody = `{"ref": "refs/heads/main", "repository": {"name": "repo", "owner": {"login": "sam"}}}`
|
||||
|
||||
func TestParseWebhookSignedDeliveries(t *testing.T) {
|
||||
c := &GiteaClient{}
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
event string
|
||||
body string
|
||||
want forge.WebhookEvent
|
||||
}{
|
||||
{
|
||||
name: "issues opened",
|
||||
event: "issues",
|
||||
body: issuesOpenedBody,
|
||||
want: forge.WebhookEvent{Issue: &forge.IssueEvent{
|
||||
Action: "opened", State: "open", PullRequest: false,
|
||||
Owner: "sam", Repo: "repo", Number: 7,
|
||||
Title: "Fix the flaky gate", Body: "It fails on retry",
|
||||
Labels: []string{"archie:queued", "bug"},
|
||||
Assignees: []string{"archie-bot", "alice"},
|
||||
}},
|
||||
},
|
||||
{
|
||||
name: "label_updated normalises to labeled",
|
||||
event: "issues",
|
||||
body: issuesLabelUpdatedBody,
|
||||
want: forge.WebhookEvent{Issue: &forge.IssueEvent{
|
||||
Action: "labeled", State: "open", PullRequest: false,
|
||||
Owner: "sam", Repo: "repo", Number: 7,
|
||||
Title: "Fix the flaky gate", Body: "It fails on retry",
|
||||
Labels: []string{"archie:queued"},
|
||||
Assignees: []string{"archie-bot"},
|
||||
}},
|
||||
},
|
||||
{
|
||||
name: "review approved",
|
||||
event: "pull_request_review_approved",
|
||||
body: reviewApprovedBody,
|
||||
want: forge.WebhookEvent{Review: &forge.ReviewEvent{
|
||||
Action: "submitted", Owner: "sam", Repo: "repo", PRNumber: 12,
|
||||
ReviewID: 0, Author: "alice", State: forge.ReviewStateApproved, Body: "lgtm",
|
||||
}},
|
||||
},
|
||||
{
|
||||
name: "review rejected",
|
||||
event: "pull_request_review_rejected",
|
||||
body: reviewRejectedBody,
|
||||
want: forge.WebhookEvent{Review: &forge.ReviewEvent{
|
||||
Action: "submitted", Owner: "sam", Repo: "repo", PRNumber: 12,
|
||||
ReviewID: 0, Author: "bob", State: forge.ReviewStateRequestedChanges, Body: "please fix the tests",
|
||||
}},
|
||||
},
|
||||
{
|
||||
name: "legacy pull_request_review carries id and state",
|
||||
event: "pull_request_review",
|
||||
body: legacyReviewBody,
|
||||
want: forge.WebhookEvent{Review: &forge.ReviewEvent{
|
||||
Action: "submitted", Owner: "sam", Repo: "repo", PRNumber: 12,
|
||||
ReviewID: 99, Author: "alice", State: forge.ReviewStateRequestedChanges, Body: "needs work",
|
||||
}},
|
||||
},
|
||||
{
|
||||
name: "push decodes to no event",
|
||||
event: "push",
|
||||
body: pushBody,
|
||||
want: forge.WebhookEvent{},
|
||||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
body := []byte(tc.body)
|
||||
headers := signDelivery(body)
|
||||
headers["X-Gitea-Event"] = tc.event
|
||||
// The host's invariant: HMAC first, parse only what verified.
|
||||
if !verifyDelivery(body, headers) {
|
||||
t.Fatalf("fixture signature did not verify: %s", headers["X-Hub-Signature-256"])
|
||||
}
|
||||
got, err := c.ParseWebhook(headers, body)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseWebhook: %v", err)
|
||||
}
|
||||
if !reflect.DeepEqual(got, tc.want) {
|
||||
t.Errorf("ParseWebhook mismatch\n got: %+v\nwant: %+v", got, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseWebhookRejectsTamperedSignatureBeforeParsing(t *testing.T) {
|
||||
c := &GiteaClient{}
|
||||
body := []byte(issuesOpenedBody)
|
||||
headers := signDelivery(body)
|
||||
headers["X-Gitea-Event"] = "issues"
|
||||
|
||||
tamperedBody := []byte(strings.Replace(issuesOpenedBody, "Fix the flaky gate", "Steal the gate", 1))
|
||||
tamperedSig := signDelivery(body)
|
||||
tamperedSig["X-Hub-Signature-256"] = "sha256=" + strings.Repeat("00", 32)
|
||||
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
body []byte
|
||||
headers map[string]string
|
||||
}{
|
||||
{"body modified after signing", tamperedBody, headers},
|
||||
{"signature from a different secret", body, tamperedSig},
|
||||
{"missing signature", body, map[string]string{"X-Gitea-Event": "issues"}},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
// The host rejects here with 401 and never calls the parser; the
|
||||
// test asserts the gate fails, so no parse-before-verify path is
|
||||
// exercised.
|
||||
if verifyDelivery(tc.body, tc.headers) {
|
||||
t.Fatalf("tampered delivery verified: %+v", tc.headers)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Sanity: the untampered delivery still verifies and parses.
|
||||
if !verifyDelivery(body, headers) {
|
||||
t.Fatal("valid delivery did not verify")
|
||||
}
|
||||
event, err := c.ParseWebhook(headers, body)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseWebhook on valid delivery: %v", err)
|
||||
}
|
||||
if event.Issue == nil || event.Issue.Number != 7 {
|
||||
t.Fatalf("valid delivery parsed to %+v", event)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseWebhookBadPayload(t *testing.T) {
|
||||
c := &GiteaClient{}
|
||||
body := []byte(`{"action":`)
|
||||
headers := signDelivery(body)
|
||||
headers["X-Gitea-Event"] = "issues"
|
||||
if !verifyDelivery(body, headers) {
|
||||
t.Fatal("fixture signature did not verify")
|
||||
}
|
||||
_, err := c.ParseWebhook(headers, body)
|
||||
if !errors.Is(err, forge.ErrBadWebhook) {
|
||||
t.Fatalf("err = %v, want ErrBadWebhook", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestParseWebhookCanonicalHeaderKey: the receiver passes Go's canonical
|
||||
// header map, so the lookup must use the canonical key.
|
||||
func TestParseWebhookCanonicalHeaderKey(t *testing.T) {
|
||||
c := &GiteaClient{}
|
||||
body := []byte(issuesOpenedBody)
|
||||
headers := signDelivery(body)
|
||||
headers[http.CanonicalHeaderKey("x-gitea-event")] = "issues"
|
||||
if !verifyDelivery(body, headers) {
|
||||
t.Fatal("fixture signature did not verify")
|
||||
}
|
||||
event, err := c.ParseWebhook(headers, body)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseWebhook: %v", err)
|
||||
}
|
||||
if event.Issue == nil {
|
||||
t.Fatalf("lowercase header not honoured: %+v", event)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// Command github is the GitHub forge extension: issues, pull requests and
|
||||
// reviews over the GitHub API, and webhook decoding.
|
||||
// reviews over the GitHub API.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: dev.archie.package.v1
|
||||
displayName: GitHub
|
||||
description: GitHub issues, pull requests, reviews and webhooks for archie-core.
|
||||
description: GitHub issues, pull requests and reviews for archie-core, as a token or a GitHub App.
|
||||
version: 1.2.0
|
||||
contributes:
|
||||
extensions:
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/google/go-github/v78/github"
|
||||
|
||||
"github.com/samcharles93/archipelago/sdk/forge"
|
||||
)
|
||||
|
||||
// ParseWebhook decodes a delivery the host has authenticated. Events the host
|
||||
// does not act on (ping, push) decode to no event.
|
||||
func (c *GitHubClient) ParseWebhook(headers map[string]string, body []byte) (forge.WebhookEvent, error) {
|
||||
event, err := github.ParseWebHook(headers[http.CanonicalHeaderKey("X-GitHub-Event")], body)
|
||||
if err != nil {
|
||||
return forge.WebhookEvent{}, fmt.Errorf("%w: %w", forge.ErrBadWebhook, err)
|
||||
}
|
||||
switch e := event.(type) {
|
||||
case *github.IssuesEvent:
|
||||
return forge.WebhookEvent{Issue: issueEvent(e)}, nil
|
||||
case *github.PullRequestReviewEvent:
|
||||
review := e.GetReview()
|
||||
if review == nil {
|
||||
return forge.WebhookEvent{}, nil
|
||||
}
|
||||
return forge.WebhookEvent{Review: &forge.ReviewEvent{
|
||||
Action: e.GetAction(),
|
||||
Owner: e.GetRepo().GetOwner().GetLogin(),
|
||||
Repo: e.GetRepo().GetName(),
|
||||
PRNumber: e.GetPullRequest().GetNumber(),
|
||||
ReviewID: review.GetID(),
|
||||
Author: review.GetUser().GetLogin(),
|
||||
State: normalizeReviewState(review.GetState()),
|
||||
Body: review.GetBody(),
|
||||
}}, nil
|
||||
case *github.PullRequestReviewCommentEvent:
|
||||
comment := e.GetComment()
|
||||
if comment == nil {
|
||||
return forge.WebhookEvent{}, nil
|
||||
}
|
||||
return forge.WebhookEvent{ReviewComment: &forge.ReviewCommentEvent{
|
||||
Action: e.GetAction(),
|
||||
Owner: e.GetRepo().GetOwner().GetLogin(),
|
||||
Repo: e.GetRepo().GetName(),
|
||||
PRNumber: e.GetPullRequest().GetNumber(),
|
||||
ReviewID: comment.GetPullRequestReviewID(),
|
||||
CommentID: comment.GetID(),
|
||||
Author: comment.GetUser().GetLogin(),
|
||||
Body: comment.GetBody(),
|
||||
Path: comment.GetPath(),
|
||||
Line: comment.GetLine(),
|
||||
}}, nil
|
||||
}
|
||||
return forge.WebhookEvent{}, nil
|
||||
}
|
||||
|
||||
func issueEvent(e *github.IssuesEvent) *forge.IssueEvent {
|
||||
issue := e.GetIssue()
|
||||
if issue == nil {
|
||||
return &forge.IssueEvent{Action: e.GetAction()}
|
||||
}
|
||||
var labels []string
|
||||
for _, l := range issue.Labels {
|
||||
if name := l.GetName(); name != "" {
|
||||
labels = append(labels, name)
|
||||
}
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
var assignees []string
|
||||
for _, u := range append(append([]*github.User{}, issue.Assignees...), issue.Assignee, e.GetAssignee()) {
|
||||
if login := u.GetLogin(); login != "" && !seen[login] {
|
||||
seen[login] = true
|
||||
assignees = append(assignees, login)
|
||||
}
|
||||
}
|
||||
return &forge.IssueEvent{
|
||||
Action: e.GetAction(),
|
||||
State: issue.GetState(),
|
||||
PullRequest: issue.IsPullRequest(),
|
||||
Owner: e.GetRepo().GetOwner().GetLogin(),
|
||||
Repo: e.GetRepo().GetName(),
|
||||
Number: issue.GetNumber(),
|
||||
Title: issue.GetTitle(),
|
||||
Body: issue.GetBody(),
|
||||
Labels: labels,
|
||||
Assignees: assignees,
|
||||
}
|
||||
}
|
||||
+1
-50
@@ -2,7 +2,6 @@ package forge
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -73,7 +72,7 @@ type PullRequest struct {
|
||||
}
|
||||
|
||||
// PullRequestReader, PullRequestDiffReader, RepoArchiveReader, ReviewReader,
|
||||
// ReviewCommentWriter and WebhookParser are optional: an extension implements
|
||||
// ReviewCommentWriter is optional: an extension implements
|
||||
// the ones its forge supports and the host sees the rest as unsupported.
|
||||
type PullRequestReader interface {
|
||||
GetPullRequest(ctx context.Context, owner, repo string, number int) (PullRequest, error)
|
||||
@@ -144,54 +143,6 @@ type ReviewCommentWriter interface {
|
||||
CreateReviewComments(ctx context.Context, owner, repo string, number int, reviewedHeadSHA string, review ReviewSubmission) error
|
||||
}
|
||||
|
||||
// WebhookEvent is a decoded delivery; at most one field is set.
|
||||
type WebhookEvent struct {
|
||||
Issue *IssueEvent
|
||||
Review *ReviewEvent
|
||||
ReviewComment *ReviewCommentEvent
|
||||
}
|
||||
|
||||
type IssueEvent struct {
|
||||
Action string
|
||||
State string
|
||||
PullRequest bool
|
||||
Owner, Repo string
|
||||
Number int
|
||||
Title, Body string
|
||||
Labels []string
|
||||
Assignees []string
|
||||
}
|
||||
|
||||
type ReviewEvent struct {
|
||||
Action string
|
||||
Owner, Repo string
|
||||
PRNumber int
|
||||
ReviewID int64
|
||||
Author string
|
||||
State string
|
||||
Body string
|
||||
}
|
||||
|
||||
type ReviewCommentEvent struct {
|
||||
Action string
|
||||
Owner, Repo string
|
||||
PRNumber int
|
||||
ReviewID int64
|
||||
CommentID int64
|
||||
Author string
|
||||
Body string
|
||||
Path string
|
||||
Line int
|
||||
}
|
||||
|
||||
// ErrBadWebhook marks a body the forge could not decode.
|
||||
var ErrBadWebhook = errors.New("undecodable webhook payload")
|
||||
|
||||
// WebhookParser decodes a delivery the host has already authenticated.
|
||||
type WebhookParser interface {
|
||||
ParseWebhook(headers map[string]string, body []byte) (WebhookEvent, error)
|
||||
}
|
||||
|
||||
// ReviewHeadDrift is an error when head is no longer reviewedHeadSHA; an empty
|
||||
// reviewedHeadSHA skips the check.
|
||||
func ReviewHeadDrift(owner, repo string, number int, head, reviewedHeadSHA string) error {
|
||||
|
||||
@@ -321,42 +321,6 @@ func (s *server) GetRepoArchive(r *forgev1.GetRepoArchiveRequest, stream forgev1
|
||||
}
|
||||
}
|
||||
|
||||
func (s *server) ParseWebhook(_ context.Context, r *forgev1.ParseWebhookRequest) (*forgev1.ParseWebhookResponse, error) {
|
||||
c, err := capability[WebhookParser](s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
event, err := c.ParseWebhook(r.GetHeaders(), r.GetBody())
|
||||
if errors.Is(err, ErrBadWebhook) {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fail(err)
|
||||
}
|
||||
repo := func(owner, name string) *forgev1.RepoRef { return &forgev1.RepoRef{Owner: owner, Repo: name} }
|
||||
switch {
|
||||
case event.Issue != nil:
|
||||
i := event.Issue
|
||||
return &forgev1.ParseWebhookResponse{Event: &forgev1.ParseWebhookResponse_Issue{Issue: &forgev1.IssueEvent{
|
||||
Action: i.Action, State: i.State, IsPullRequest: i.PullRequest, Repo: repo(i.Owner, i.Repo), Number: int32(i.Number), //nolint:gosec // issue numbers fit int32
|
||||
Title: i.Title, Body: i.Body, Labels: i.Labels, Assignees: i.Assignees,
|
||||
}}}, nil
|
||||
case event.Review != nil:
|
||||
v := event.Review
|
||||
return &forgev1.ParseWebhookResponse{Event: &forgev1.ParseWebhookResponse_Review{Review: &forgev1.ReviewEvent{
|
||||
Action: v.Action, Repo: repo(v.Owner, v.Repo), PrNumber: int32(v.PRNumber), ReviewId: v.ReviewID, //nolint:gosec // issue numbers fit int32
|
||||
Author: v.Author, State: v.State, Body: v.Body,
|
||||
}}}, nil
|
||||
case event.ReviewComment != nil:
|
||||
c := event.ReviewComment
|
||||
return &forgev1.ParseWebhookResponse{Event: &forgev1.ParseWebhookResponse_ReviewComment{ReviewComment: &forgev1.ReviewCommentEvent{
|
||||
Action: c.Action, Repo: repo(c.Owner, c.Repo), PrNumber: int32(c.PRNumber), ReviewId: c.ReviewID, CommentId: c.CommentID, //nolint:gosec // issue numbers fit int32
|
||||
Author: c.Author, Body: c.Body, Path: c.Path, Line: int32(c.Line), //nolint:gosec // line numbers fit int32
|
||||
}}}, nil
|
||||
}
|
||||
return &forgev1.ParseWebhookResponse{}, nil
|
||||
}
|
||||
|
||||
func (s *server) GitCredential(ctx context.Context, r *forgev1.GitCredentialRequest) (*forgev1.GitCredentialResponse, error) {
|
||||
c, err := capability[GitCredentialIssuer](s)
|
||||
if err != nil {
|
||||
|
||||
+61
-581
@@ -2804,464 +2804,6 @@ func (x *GetRepoArchiveResponse) GetData() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ParseWebhookRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ParseWebhookRequest) Reset() {
|
||||
*x = ParseWebhookRequest{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[53]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ParseWebhookRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ParseWebhookRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ParseWebhookRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[53]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ParseWebhookRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ParseWebhookRequest) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{53}
|
||||
}
|
||||
|
||||
func (x *ParseWebhookRequest) GetHeaders() map[string]string {
|
||||
if x != nil {
|
||||
return x.Headers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseWebhookRequest) GetBody() []byte {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ParseWebhookResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Types that are valid to be assigned to Event:
|
||||
//
|
||||
// *ParseWebhookResponse_Issue
|
||||
// *ParseWebhookResponse_Review
|
||||
// *ParseWebhookResponse_ReviewComment
|
||||
Event isParseWebhookResponse_Event `protobuf_oneof:"event"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) Reset() {
|
||||
*x = ParseWebhookResponse{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[54]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ParseWebhookResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ParseWebhookResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[54]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ParseWebhookResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ParseWebhookResponse) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{54}
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) GetEvent() isParseWebhookResponse_Event {
|
||||
if x != nil {
|
||||
return x.Event
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) GetIssue() *IssueEvent {
|
||||
if x != nil {
|
||||
if x, ok := x.Event.(*ParseWebhookResponse_Issue); ok {
|
||||
return x.Issue
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) GetReview() *ReviewEvent {
|
||||
if x != nil {
|
||||
if x, ok := x.Event.(*ParseWebhookResponse_Review); ok {
|
||||
return x.Review
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) GetReviewComment() *ReviewCommentEvent {
|
||||
if x != nil {
|
||||
if x, ok := x.Event.(*ParseWebhookResponse_ReviewComment); ok {
|
||||
return x.ReviewComment
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isParseWebhookResponse_Event interface {
|
||||
isParseWebhookResponse_Event()
|
||||
}
|
||||
|
||||
type ParseWebhookResponse_Issue struct {
|
||||
Issue *IssueEvent `protobuf:"bytes,1,opt,name=issue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ParseWebhookResponse_Review struct {
|
||||
Review *ReviewEvent `protobuf:"bytes,2,opt,name=review,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ParseWebhookResponse_ReviewComment struct {
|
||||
ReviewComment *ReviewCommentEvent `protobuf:"bytes,3,opt,name=review_comment,json=reviewComment,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*ParseWebhookResponse_Issue) isParseWebhookResponse_Event() {}
|
||||
|
||||
func (*ParseWebhookResponse_Review) isParseWebhookResponse_Event() {}
|
||||
|
||||
func (*ParseWebhookResponse_ReviewComment) isParseWebhookResponse_Event() {}
|
||||
|
||||
type IssueEvent struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
|
||||
State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
|
||||
IsPullRequest bool `protobuf:"varint,3,opt,name=is_pull_request,json=isPullRequest,proto3" json:"is_pull_request,omitempty"`
|
||||
Repo *RepoRef `protobuf:"bytes,4,opt,name=repo,proto3" json:"repo,omitempty"`
|
||||
Number int32 `protobuf:"varint,5,opt,name=number,proto3" json:"number,omitempty"`
|
||||
Title string `protobuf:"bytes,6,opt,name=title,proto3" json:"title,omitempty"`
|
||||
Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
|
||||
Labels []string `protobuf:"bytes,8,rep,name=labels,proto3" json:"labels,omitempty"`
|
||||
Assignees []string `protobuf:"bytes,9,rep,name=assignees,proto3" json:"assignees,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IssueEvent) Reset() {
|
||||
*x = IssueEvent{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[55]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IssueEvent) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IssueEvent) ProtoMessage() {}
|
||||
|
||||
func (x *IssueEvent) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[55]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use IssueEvent.ProtoReflect.Descriptor instead.
|
||||
func (*IssueEvent) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{55}
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetState() string {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetIsPullRequest() bool {
|
||||
if x != nil {
|
||||
return x.IsPullRequest
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetRepo() *RepoRef {
|
||||
if x != nil {
|
||||
return x.Repo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetNumber() int32 {
|
||||
if x != nil {
|
||||
return x.Number
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetBody() string {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetLabels() []string {
|
||||
if x != nil {
|
||||
return x.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetAssignees() []string {
|
||||
if x != nil {
|
||||
return x.Assignees
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReviewEvent struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
|
||||
Repo *RepoRef `protobuf:"bytes,2,opt,name=repo,proto3" json:"repo,omitempty"`
|
||||
PrNumber int32 `protobuf:"varint,3,opt,name=pr_number,json=prNumber,proto3" json:"pr_number,omitempty"`
|
||||
ReviewId int64 `protobuf:"varint,4,opt,name=review_id,json=reviewId,proto3" json:"review_id,omitempty"`
|
||||
Author string `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"`
|
||||
State string `protobuf:"bytes,6,opt,name=state,proto3" json:"state,omitempty"`
|
||||
Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) Reset() {
|
||||
*x = ReviewEvent{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[56]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ReviewEvent) ProtoMessage() {}
|
||||
|
||||
func (x *ReviewEvent) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[56]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ReviewEvent.ProtoReflect.Descriptor instead.
|
||||
func (*ReviewEvent) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{56}
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetRepo() *RepoRef {
|
||||
if x != nil {
|
||||
return x.Repo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetPrNumber() int32 {
|
||||
if x != nil {
|
||||
return x.PrNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetReviewId() int64 {
|
||||
if x != nil {
|
||||
return x.ReviewId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetAuthor() string {
|
||||
if x != nil {
|
||||
return x.Author
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetState() string {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetBody() string {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ReviewCommentEvent struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
|
||||
Repo *RepoRef `protobuf:"bytes,2,opt,name=repo,proto3" json:"repo,omitempty"`
|
||||
PrNumber int32 `protobuf:"varint,3,opt,name=pr_number,json=prNumber,proto3" json:"pr_number,omitempty"`
|
||||
ReviewId int64 `protobuf:"varint,4,opt,name=review_id,json=reviewId,proto3" json:"review_id,omitempty"`
|
||||
CommentId int64 `protobuf:"varint,5,opt,name=comment_id,json=commentId,proto3" json:"comment_id,omitempty"`
|
||||
Author string `protobuf:"bytes,6,opt,name=author,proto3" json:"author,omitempty"`
|
||||
Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
|
||||
Path string `protobuf:"bytes,8,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Line int32 `protobuf:"varint,9,opt,name=line,proto3" json:"line,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) Reset() {
|
||||
*x = ReviewCommentEvent{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[57]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ReviewCommentEvent) ProtoMessage() {}
|
||||
|
||||
func (x *ReviewCommentEvent) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[57]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ReviewCommentEvent.ProtoReflect.Descriptor instead.
|
||||
func (*ReviewCommentEvent) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{57}
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetRepo() *RepoRef {
|
||||
if x != nil {
|
||||
return x.Repo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetPrNumber() int32 {
|
||||
if x != nil {
|
||||
return x.PrNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetReviewId() int64 {
|
||||
if x != nil {
|
||||
return x.ReviewId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetCommentId() int64 {
|
||||
if x != nil {
|
||||
return x.CommentId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetAuthor() string {
|
||||
if x != nil {
|
||||
return x.Author
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetBody() string {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetPath() string {
|
||||
if x != nil {
|
||||
return x.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetLine() int32 {
|
||||
if x != nil {
|
||||
return x.Line
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_forge_v1_forge_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_forge_v1_forge_proto_rawDesc = "" +
|
||||
@@ -3434,48 +2976,7 @@ const file_forge_v1_forge_proto_rawDesc = "" +
|
||||
"\x04repo\x18\x01 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\x12\x10\n" +
|
||||
"\x03ref\x18\x02 \x01(\tR\x03ref\",\n" +
|
||||
"\x16GetRepoArchiveResponse\x12\x12\n" +
|
||||
"\x04data\x18\x01 \x01(\fR\x04data\"\xab\x01\n" +
|
||||
"\x13ParseWebhookRequest\x12D\n" +
|
||||
"\aheaders\x18\x01 \x03(\v2*.forge.v1.ParseWebhookRequest.HeadersEntryR\aheaders\x12\x12\n" +
|
||||
"\x04body\x18\x02 \x01(\fR\x04body\x1a:\n" +
|
||||
"\fHeadersEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc5\x01\n" +
|
||||
"\x14ParseWebhookResponse\x12,\n" +
|
||||
"\x05issue\x18\x01 \x01(\v2\x14.forge.v1.IssueEventH\x00R\x05issue\x12/\n" +
|
||||
"\x06review\x18\x02 \x01(\v2\x15.forge.v1.ReviewEventH\x00R\x06review\x12E\n" +
|
||||
"\x0ereview_comment\x18\x03 \x01(\v2\x1c.forge.v1.ReviewCommentEventH\x00R\rreviewCommentB\a\n" +
|
||||
"\x05event\"\x81\x02\n" +
|
||||
"\n" +
|
||||
"IssueEvent\x12\x16\n" +
|
||||
"\x06action\x18\x01 \x01(\tR\x06action\x12\x14\n" +
|
||||
"\x05state\x18\x02 \x01(\tR\x05state\x12&\n" +
|
||||
"\x0fis_pull_request\x18\x03 \x01(\bR\risPullRequest\x12%\n" +
|
||||
"\x04repo\x18\x04 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\x12\x16\n" +
|
||||
"\x06number\x18\x05 \x01(\x05R\x06number\x12\x14\n" +
|
||||
"\x05title\x18\x06 \x01(\tR\x05title\x12\x12\n" +
|
||||
"\x04body\x18\a \x01(\tR\x04body\x12\x16\n" +
|
||||
"\x06labels\x18\b \x03(\tR\x06labels\x12\x1c\n" +
|
||||
"\tassignees\x18\t \x03(\tR\tassignees\"\xc8\x01\n" +
|
||||
"\vReviewEvent\x12\x16\n" +
|
||||
"\x06action\x18\x01 \x01(\tR\x06action\x12%\n" +
|
||||
"\x04repo\x18\x02 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\x12\x1b\n" +
|
||||
"\tpr_number\x18\x03 \x01(\x05R\bprNumber\x12\x1b\n" +
|
||||
"\treview_id\x18\x04 \x01(\x03R\breviewId\x12\x16\n" +
|
||||
"\x06author\x18\x05 \x01(\tR\x06author\x12\x14\n" +
|
||||
"\x05state\x18\x06 \x01(\tR\x05state\x12\x12\n" +
|
||||
"\x04body\x18\a \x01(\tR\x04body\"\x80\x02\n" +
|
||||
"\x12ReviewCommentEvent\x12\x16\n" +
|
||||
"\x06action\x18\x01 \x01(\tR\x06action\x12%\n" +
|
||||
"\x04repo\x18\x02 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\x12\x1b\n" +
|
||||
"\tpr_number\x18\x03 \x01(\x05R\bprNumber\x12\x1b\n" +
|
||||
"\treview_id\x18\x04 \x01(\x03R\breviewId\x12\x1d\n" +
|
||||
"\n" +
|
||||
"comment_id\x18\x05 \x01(\x03R\tcommentId\x12\x16\n" +
|
||||
"\x06author\x18\x06 \x01(\tR\x06author\x12\x12\n" +
|
||||
"\x04body\x18\a \x01(\tR\x04body\x12\x12\n" +
|
||||
"\x04path\x18\b \x01(\tR\x04path\x12\x12\n" +
|
||||
"\x04line\x18\t \x01(\x05R\x04line2\xe9\x0e\n" +
|
||||
"\x04data\x18\x01 \x01(\fR\x04data2\x9a\x0e\n" +
|
||||
"\fForgeService\x12D\n" +
|
||||
"\tConfigure\x12\x1a.forge.v1.ConfigureRequest\x1a\x1b.forge.v1.ConfigureResponse\x12S\n" +
|
||||
"\x0eAssignedIssues\x12\x1f.forge.v1.AssignedIssuesRequest\x1a .forge.v1.AssignedIssuesResponse\x12V\n" +
|
||||
@@ -3501,8 +3002,7 @@ const file_forge_v1_forge_proto_rawDesc = "" +
|
||||
"VerifyPush\x12\x1b.forge.v1.VerifyPushRequest\x1a\x1c.forge.v1.VerifyPushResponse\x12G\n" +
|
||||
"\n" +
|
||||
"LinkBranch\x12\x1b.forge.v1.LinkBranchRequest\x1a\x1c.forge.v1.LinkBranchResponse\x12P\n" +
|
||||
"\rGitCredential\x12\x1e.forge.v1.GitCredentialRequest\x1a\x1f.forge.v1.GitCredentialResponse\x12M\n" +
|
||||
"\fParseWebhook\x12\x1d.forge.v1.ParseWebhookRequest\x1a\x1e.forge.v1.ParseWebhookResponse\x12U\n" +
|
||||
"\rGitCredential\x12\x1e.forge.v1.GitCredentialRequest\x1a\x1f.forge.v1.GitCredentialResponse\x12U\n" +
|
||||
"\x0eGetRepoArchive\x12\x1f.forge.v1.GetRepoArchiveRequest\x1a .forge.v1.GetRepoArchiveResponse0\x01B\x95\x01\n" +
|
||||
"\fcom.forge.v1B\n" +
|
||||
"ForgeProtoP\x01Z8github.com/samcharles93/archipelago/sdk/forge/v1;forgev1\xa2\x02\x03FXX\xaa\x02\bForge.V1\xca\x02\bForge\\V1\xe2\x02\x14Forge\\V1\\GPBMetadata\xea\x02\tForge::V1b\x06proto3"
|
||||
@@ -3519,7 +3019,7 @@ func file_forge_v1_forge_proto_rawDescGZIP() []byte {
|
||||
return file_forge_v1_forge_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_forge_v1_forge_proto_msgTypes = make([]protoimpl.MessageInfo, 60)
|
||||
var file_forge_v1_forge_proto_msgTypes = make([]protoimpl.MessageInfo, 54)
|
||||
var file_forge_v1_forge_proto_goTypes = []any{
|
||||
(*ConfigureRequest)(nil), // 0: forge.v1.ConfigureRequest
|
||||
(*ConfigureResponse)(nil), // 1: forge.v1.ConfigureResponse
|
||||
@@ -3574,17 +3074,11 @@ var file_forge_v1_forge_proto_goTypes = []any{
|
||||
(*GitCredentialResponse)(nil), // 50: forge.v1.GitCredentialResponse
|
||||
(*GetRepoArchiveRequest)(nil), // 51: forge.v1.GetRepoArchiveRequest
|
||||
(*GetRepoArchiveResponse)(nil), // 52: forge.v1.GetRepoArchiveResponse
|
||||
(*ParseWebhookRequest)(nil), // 53: forge.v1.ParseWebhookRequest
|
||||
(*ParseWebhookResponse)(nil), // 54: forge.v1.ParseWebhookResponse
|
||||
(*IssueEvent)(nil), // 55: forge.v1.IssueEvent
|
||||
(*ReviewEvent)(nil), // 56: forge.v1.ReviewEvent
|
||||
(*ReviewCommentEvent)(nil), // 57: forge.v1.ReviewCommentEvent
|
||||
nil, // 58: forge.v1.ConfigureRequest.SettingsEntry
|
||||
nil, // 59: forge.v1.ParseWebhookRequest.HeadersEntry
|
||||
(*timestamppb.Timestamp)(nil), // 60: google.protobuf.Timestamp
|
||||
nil, // 53: forge.v1.ConfigureRequest.SettingsEntry
|
||||
(*timestamppb.Timestamp)(nil), // 54: google.protobuf.Timestamp
|
||||
}
|
||||
var file_forge_v1_forge_proto_depIdxs = []int32{
|
||||
58, // 0: forge.v1.ConfigureRequest.settings:type_name -> forge.v1.ConfigureRequest.SettingsEntry
|
||||
53, // 0: forge.v1.ConfigureRequest.settings:type_name -> forge.v1.ConfigureRequest.SettingsEntry
|
||||
2, // 1: forge.v1.PullRequestRef.repo:type_name -> forge.v1.RepoRef
|
||||
4, // 2: forge.v1.AssignedIssuesResponse.issues:type_name -> forge.v1.Issue
|
||||
4, // 3: forge.v1.IssuesWithLabelResponse.issues:type_name -> forge.v1.Issue
|
||||
@@ -3603,9 +3097,9 @@ var file_forge_v1_forge_proto_depIdxs = []int32{
|
||||
27, // 16: forge.v1.GetPullRequestResponse.pull_request:type_name -> forge.v1.PullRequest
|
||||
2, // 17: forge.v1.GetPullRequestDiffRequest.repo:type_name -> forge.v1.RepoRef
|
||||
3, // 18: forge.v1.ListReviewsRequest.pull_request:type_name -> forge.v1.PullRequestRef
|
||||
60, // 19: forge.v1.Review.submitted_at:type_name -> google.protobuf.Timestamp
|
||||
54, // 19: forge.v1.Review.submitted_at:type_name -> google.protobuf.Timestamp
|
||||
33, // 20: forge.v1.ListReviewsResponse.reviews:type_name -> forge.v1.Review
|
||||
60, // 21: forge.v1.ReviewComment.created_at:type_name -> google.protobuf.Timestamp
|
||||
54, // 21: forge.v1.ReviewComment.created_at:type_name -> google.protobuf.Timestamp
|
||||
3, // 22: forge.v1.ListReviewCommentsRequest.pull_request:type_name -> forge.v1.PullRequestRef
|
||||
35, // 23: forge.v1.ListReviewCommentsResponse.comments:type_name -> forge.v1.ReviewComment
|
||||
3, // 24: forge.v1.ReplyToReviewRequest.pull_request:type_name -> forge.v1.PullRequestRef
|
||||
@@ -3615,68 +3109,59 @@ var file_forge_v1_forge_proto_depIdxs = []int32{
|
||||
2, // 28: forge.v1.AcceptInvitationsRequest.repositories:type_name -> forge.v1.RepoRef
|
||||
2, // 29: forge.v1.VerifyPushRequest.repo:type_name -> forge.v1.RepoRef
|
||||
2, // 30: forge.v1.GitCredentialRequest.repo:type_name -> forge.v1.RepoRef
|
||||
60, // 31: forge.v1.GitCredentialResponse.expires_at:type_name -> google.protobuf.Timestamp
|
||||
54, // 31: forge.v1.GitCredentialResponse.expires_at:type_name -> google.protobuf.Timestamp
|
||||
2, // 32: forge.v1.GetRepoArchiveRequest.repo:type_name -> forge.v1.RepoRef
|
||||
59, // 33: forge.v1.ParseWebhookRequest.headers:type_name -> forge.v1.ParseWebhookRequest.HeadersEntry
|
||||
55, // 34: forge.v1.ParseWebhookResponse.issue:type_name -> forge.v1.IssueEvent
|
||||
56, // 35: forge.v1.ParseWebhookResponse.review:type_name -> forge.v1.ReviewEvent
|
||||
57, // 36: forge.v1.ParseWebhookResponse.review_comment:type_name -> forge.v1.ReviewCommentEvent
|
||||
2, // 37: forge.v1.IssueEvent.repo:type_name -> forge.v1.RepoRef
|
||||
2, // 38: forge.v1.ReviewEvent.repo:type_name -> forge.v1.RepoRef
|
||||
2, // 39: forge.v1.ReviewCommentEvent.repo:type_name -> forge.v1.RepoRef
|
||||
0, // 40: forge.v1.ForgeService.Configure:input_type -> forge.v1.ConfigureRequest
|
||||
7, // 41: forge.v1.ForgeService.AssignedIssues:input_type -> forge.v1.AssignedIssuesRequest
|
||||
8, // 42: forge.v1.ForgeService.IssuesWithLabel:input_type -> forge.v1.IssuesWithLabelRequest
|
||||
9, // 43: forge.v1.ForgeService.Comment:input_type -> forge.v1.CommentRequest
|
||||
11, // 44: forge.v1.ForgeService.CreateIssue:input_type -> forge.v1.CreateIssueRequest
|
||||
13, // 45: forge.v1.ForgeService.CloseIssue:input_type -> forge.v1.CloseIssueRequest
|
||||
19, // 46: forge.v1.ForgeService.React:input_type -> forge.v1.ReactRequest
|
||||
21, // 47: forge.v1.ForgeService.SetStateLabel:input_type -> forge.v1.SetStateLabelRequest
|
||||
23, // 48: forge.v1.ForgeService.CreatePR:input_type -> forge.v1.CreatePRRequest
|
||||
25, // 49: forge.v1.ForgeService.PRState:input_type -> forge.v1.PRStateRequest
|
||||
15, // 50: forge.v1.ForgeService.ClosePR:input_type -> forge.v1.ClosePRRequest
|
||||
17, // 51: forge.v1.ForgeService.MergePR:input_type -> forge.v1.MergePRRequest
|
||||
28, // 52: forge.v1.ForgeService.GetPullRequest:input_type -> forge.v1.GetPullRequestRequest
|
||||
30, // 53: forge.v1.ForgeService.GetPullRequestDiff:input_type -> forge.v1.GetPullRequestDiffRequest
|
||||
32, // 54: forge.v1.ForgeService.ListReviews:input_type -> forge.v1.ListReviewsRequest
|
||||
36, // 55: forge.v1.ForgeService.ListReviewComments:input_type -> forge.v1.ListReviewCommentsRequest
|
||||
38, // 56: forge.v1.ForgeService.ReplyToReview:input_type -> forge.v1.ReplyToReviewRequest
|
||||
41, // 57: forge.v1.ForgeService.CreateReviewComments:input_type -> forge.v1.CreateReviewCommentsRequest
|
||||
45, // 58: forge.v1.ForgeService.AcceptInvitations:input_type -> forge.v1.AcceptInvitationsRequest
|
||||
47, // 59: forge.v1.ForgeService.VerifyPush:input_type -> forge.v1.VerifyPushRequest
|
||||
43, // 60: forge.v1.ForgeService.LinkBranch:input_type -> forge.v1.LinkBranchRequest
|
||||
49, // 61: forge.v1.ForgeService.GitCredential:input_type -> forge.v1.GitCredentialRequest
|
||||
53, // 62: forge.v1.ForgeService.ParseWebhook:input_type -> forge.v1.ParseWebhookRequest
|
||||
51, // 63: forge.v1.ForgeService.GetRepoArchive:input_type -> forge.v1.GetRepoArchiveRequest
|
||||
1, // 64: forge.v1.ForgeService.Configure:output_type -> forge.v1.ConfigureResponse
|
||||
5, // 65: forge.v1.ForgeService.AssignedIssues:output_type -> forge.v1.AssignedIssuesResponse
|
||||
6, // 66: forge.v1.ForgeService.IssuesWithLabel:output_type -> forge.v1.IssuesWithLabelResponse
|
||||
10, // 67: forge.v1.ForgeService.Comment:output_type -> forge.v1.CommentResponse
|
||||
12, // 68: forge.v1.ForgeService.CreateIssue:output_type -> forge.v1.CreateIssueResponse
|
||||
14, // 69: forge.v1.ForgeService.CloseIssue:output_type -> forge.v1.CloseIssueResponse
|
||||
20, // 70: forge.v1.ForgeService.React:output_type -> forge.v1.ReactResponse
|
||||
22, // 71: forge.v1.ForgeService.SetStateLabel:output_type -> forge.v1.SetStateLabelResponse
|
||||
24, // 72: forge.v1.ForgeService.CreatePR:output_type -> forge.v1.CreatePRResponse
|
||||
26, // 73: forge.v1.ForgeService.PRState:output_type -> forge.v1.PRStateResponse
|
||||
16, // 74: forge.v1.ForgeService.ClosePR:output_type -> forge.v1.ClosePRResponse
|
||||
18, // 75: forge.v1.ForgeService.MergePR:output_type -> forge.v1.MergePRResponse
|
||||
29, // 76: forge.v1.ForgeService.GetPullRequest:output_type -> forge.v1.GetPullRequestResponse
|
||||
31, // 77: forge.v1.ForgeService.GetPullRequestDiff:output_type -> forge.v1.GetPullRequestDiffResponse
|
||||
34, // 78: forge.v1.ForgeService.ListReviews:output_type -> forge.v1.ListReviewsResponse
|
||||
37, // 79: forge.v1.ForgeService.ListReviewComments:output_type -> forge.v1.ListReviewCommentsResponse
|
||||
39, // 80: forge.v1.ForgeService.ReplyToReview:output_type -> forge.v1.ReplyToReviewResponse
|
||||
42, // 81: forge.v1.ForgeService.CreateReviewComments:output_type -> forge.v1.CreateReviewCommentsResponse
|
||||
46, // 82: forge.v1.ForgeService.AcceptInvitations:output_type -> forge.v1.AcceptInvitationsResponse
|
||||
48, // 83: forge.v1.ForgeService.VerifyPush:output_type -> forge.v1.VerifyPushResponse
|
||||
44, // 84: forge.v1.ForgeService.LinkBranch:output_type -> forge.v1.LinkBranchResponse
|
||||
50, // 85: forge.v1.ForgeService.GitCredential:output_type -> forge.v1.GitCredentialResponse
|
||||
54, // 86: forge.v1.ForgeService.ParseWebhook:output_type -> forge.v1.ParseWebhookResponse
|
||||
52, // 87: forge.v1.ForgeService.GetRepoArchive:output_type -> forge.v1.GetRepoArchiveResponse
|
||||
64, // [64:88] is the sub-list for method output_type
|
||||
40, // [40:64] is the sub-list for method input_type
|
||||
40, // [40:40] is the sub-list for extension type_name
|
||||
40, // [40:40] is the sub-list for extension extendee
|
||||
0, // [0:40] is the sub-list for field type_name
|
||||
0, // 33: forge.v1.ForgeService.Configure:input_type -> forge.v1.ConfigureRequest
|
||||
7, // 34: forge.v1.ForgeService.AssignedIssues:input_type -> forge.v1.AssignedIssuesRequest
|
||||
8, // 35: forge.v1.ForgeService.IssuesWithLabel:input_type -> forge.v1.IssuesWithLabelRequest
|
||||
9, // 36: forge.v1.ForgeService.Comment:input_type -> forge.v1.CommentRequest
|
||||
11, // 37: forge.v1.ForgeService.CreateIssue:input_type -> forge.v1.CreateIssueRequest
|
||||
13, // 38: forge.v1.ForgeService.CloseIssue:input_type -> forge.v1.CloseIssueRequest
|
||||
19, // 39: forge.v1.ForgeService.React:input_type -> forge.v1.ReactRequest
|
||||
21, // 40: forge.v1.ForgeService.SetStateLabel:input_type -> forge.v1.SetStateLabelRequest
|
||||
23, // 41: forge.v1.ForgeService.CreatePR:input_type -> forge.v1.CreatePRRequest
|
||||
25, // 42: forge.v1.ForgeService.PRState:input_type -> forge.v1.PRStateRequest
|
||||
15, // 43: forge.v1.ForgeService.ClosePR:input_type -> forge.v1.ClosePRRequest
|
||||
17, // 44: forge.v1.ForgeService.MergePR:input_type -> forge.v1.MergePRRequest
|
||||
28, // 45: forge.v1.ForgeService.GetPullRequest:input_type -> forge.v1.GetPullRequestRequest
|
||||
30, // 46: forge.v1.ForgeService.GetPullRequestDiff:input_type -> forge.v1.GetPullRequestDiffRequest
|
||||
32, // 47: forge.v1.ForgeService.ListReviews:input_type -> forge.v1.ListReviewsRequest
|
||||
36, // 48: forge.v1.ForgeService.ListReviewComments:input_type -> forge.v1.ListReviewCommentsRequest
|
||||
38, // 49: forge.v1.ForgeService.ReplyToReview:input_type -> forge.v1.ReplyToReviewRequest
|
||||
41, // 50: forge.v1.ForgeService.CreateReviewComments:input_type -> forge.v1.CreateReviewCommentsRequest
|
||||
45, // 51: forge.v1.ForgeService.AcceptInvitations:input_type -> forge.v1.AcceptInvitationsRequest
|
||||
47, // 52: forge.v1.ForgeService.VerifyPush:input_type -> forge.v1.VerifyPushRequest
|
||||
43, // 53: forge.v1.ForgeService.LinkBranch:input_type -> forge.v1.LinkBranchRequest
|
||||
49, // 54: forge.v1.ForgeService.GitCredential:input_type -> forge.v1.GitCredentialRequest
|
||||
51, // 55: forge.v1.ForgeService.GetRepoArchive:input_type -> forge.v1.GetRepoArchiveRequest
|
||||
1, // 56: forge.v1.ForgeService.Configure:output_type -> forge.v1.ConfigureResponse
|
||||
5, // 57: forge.v1.ForgeService.AssignedIssues:output_type -> forge.v1.AssignedIssuesResponse
|
||||
6, // 58: forge.v1.ForgeService.IssuesWithLabel:output_type -> forge.v1.IssuesWithLabelResponse
|
||||
10, // 59: forge.v1.ForgeService.Comment:output_type -> forge.v1.CommentResponse
|
||||
12, // 60: forge.v1.ForgeService.CreateIssue:output_type -> forge.v1.CreateIssueResponse
|
||||
14, // 61: forge.v1.ForgeService.CloseIssue:output_type -> forge.v1.CloseIssueResponse
|
||||
20, // 62: forge.v1.ForgeService.React:output_type -> forge.v1.ReactResponse
|
||||
22, // 63: forge.v1.ForgeService.SetStateLabel:output_type -> forge.v1.SetStateLabelResponse
|
||||
24, // 64: forge.v1.ForgeService.CreatePR:output_type -> forge.v1.CreatePRResponse
|
||||
26, // 65: forge.v1.ForgeService.PRState:output_type -> forge.v1.PRStateResponse
|
||||
16, // 66: forge.v1.ForgeService.ClosePR:output_type -> forge.v1.ClosePRResponse
|
||||
18, // 67: forge.v1.ForgeService.MergePR:output_type -> forge.v1.MergePRResponse
|
||||
29, // 68: forge.v1.ForgeService.GetPullRequest:output_type -> forge.v1.GetPullRequestResponse
|
||||
31, // 69: forge.v1.ForgeService.GetPullRequestDiff:output_type -> forge.v1.GetPullRequestDiffResponse
|
||||
34, // 70: forge.v1.ForgeService.ListReviews:output_type -> forge.v1.ListReviewsResponse
|
||||
37, // 71: forge.v1.ForgeService.ListReviewComments:output_type -> forge.v1.ListReviewCommentsResponse
|
||||
39, // 72: forge.v1.ForgeService.ReplyToReview:output_type -> forge.v1.ReplyToReviewResponse
|
||||
42, // 73: forge.v1.ForgeService.CreateReviewComments:output_type -> forge.v1.CreateReviewCommentsResponse
|
||||
46, // 74: forge.v1.ForgeService.AcceptInvitations:output_type -> forge.v1.AcceptInvitationsResponse
|
||||
48, // 75: forge.v1.ForgeService.VerifyPush:output_type -> forge.v1.VerifyPushResponse
|
||||
44, // 76: forge.v1.ForgeService.LinkBranch:output_type -> forge.v1.LinkBranchResponse
|
||||
50, // 77: forge.v1.ForgeService.GitCredential:output_type -> forge.v1.GitCredentialResponse
|
||||
52, // 78: forge.v1.ForgeService.GetRepoArchive:output_type -> forge.v1.GetRepoArchiveResponse
|
||||
56, // [56:79] is the sub-list for method output_type
|
||||
33, // [33:56] is the sub-list for method input_type
|
||||
33, // [33:33] is the sub-list for extension type_name
|
||||
33, // [33:33] is the sub-list for extension extendee
|
||||
0, // [0:33] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_forge_v1_forge_proto_init() }
|
||||
@@ -3684,18 +3169,13 @@ func file_forge_v1_forge_proto_init() {
|
||||
if File_forge_v1_forge_proto != nil {
|
||||
return
|
||||
}
|
||||
file_forge_v1_forge_proto_msgTypes[54].OneofWrappers = []any{
|
||||
(*ParseWebhookResponse_Issue)(nil),
|
||||
(*ParseWebhookResponse_Review)(nil),
|
||||
(*ParseWebhookResponse_ReviewComment)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_forge_v1_forge_proto_rawDesc), len(file_forge_v1_forge_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 60,
|
||||
NumMessages: 54,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -41,7 +41,6 @@ const (
|
||||
ForgeService_VerifyPush_FullMethodName = "/forge.v1.ForgeService/VerifyPush"
|
||||
ForgeService_LinkBranch_FullMethodName = "/forge.v1.ForgeService/LinkBranch"
|
||||
ForgeService_GitCredential_FullMethodName = "/forge.v1.ForgeService/GitCredential"
|
||||
ForgeService_ParseWebhook_FullMethodName = "/forge.v1.ForgeService/ParseWebhook"
|
||||
ForgeService_GetRepoArchive_FullMethodName = "/forge.v1.ForgeService/GetRepoArchive"
|
||||
)
|
||||
|
||||
@@ -83,10 +82,6 @@ type ForgeServiceClient interface {
|
||||
// repository, and the identity commits through it should carry. A forge that
|
||||
// authenticates git with its configured token answers UNIMPLEMENTED.
|
||||
GitCredential(ctx context.Context, in *GitCredentialRequest, opts ...grpc.CallOption) (*GitCredentialResponse, error)
|
||||
// ParseWebhook decodes one webhook delivery the host has already
|
||||
// authenticated. A delivery that is not an event the host acts on returns no
|
||||
// event; an undecodable body is INVALID_ARGUMENT.
|
||||
ParseWebhook(ctx context.Context, in *ParseWebhookRequest, opts ...grpc.CallOption) (*ParseWebhookResponse, error)
|
||||
// GetRepoArchive streams a gzipped tar of the repository at a ref.
|
||||
GetRepoArchive(ctx context.Context, in *GetRepoArchiveRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetRepoArchiveResponse], error)
|
||||
}
|
||||
@@ -319,16 +314,6 @@ func (c *forgeServiceClient) GitCredential(ctx context.Context, in *GitCredentia
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *forgeServiceClient) ParseWebhook(ctx context.Context, in *ParseWebhookRequest, opts ...grpc.CallOption) (*ParseWebhookResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ParseWebhookResponse)
|
||||
err := c.cc.Invoke(ctx, ForgeService_ParseWebhook_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *forgeServiceClient) GetRepoArchive(ctx context.Context, in *GetRepoArchiveRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetRepoArchiveResponse], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &ForgeService_ServiceDesc.Streams[0], ForgeService_GetRepoArchive_FullMethodName, cOpts...)
|
||||
@@ -386,10 +371,6 @@ type ForgeServiceServer interface {
|
||||
// repository, and the identity commits through it should carry. A forge that
|
||||
// authenticates git with its configured token answers UNIMPLEMENTED.
|
||||
GitCredential(context.Context, *GitCredentialRequest) (*GitCredentialResponse, error)
|
||||
// ParseWebhook decodes one webhook delivery the host has already
|
||||
// authenticated. A delivery that is not an event the host acts on returns no
|
||||
// event; an undecodable body is INVALID_ARGUMENT.
|
||||
ParseWebhook(context.Context, *ParseWebhookRequest) (*ParseWebhookResponse, error)
|
||||
// GetRepoArchive streams a gzipped tar of the repository at a ref.
|
||||
GetRepoArchive(*GetRepoArchiveRequest, grpc.ServerStreamingServer[GetRepoArchiveResponse]) error
|
||||
mustEmbedUnimplementedForgeServiceServer()
|
||||
@@ -468,9 +449,6 @@ func (UnimplementedForgeServiceServer) LinkBranch(context.Context, *LinkBranchRe
|
||||
func (UnimplementedForgeServiceServer) GitCredential(context.Context, *GitCredentialRequest) (*GitCredentialResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GitCredential not implemented")
|
||||
}
|
||||
func (UnimplementedForgeServiceServer) ParseWebhook(context.Context, *ParseWebhookRequest) (*ParseWebhookResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ParseWebhook not implemented")
|
||||
}
|
||||
func (UnimplementedForgeServiceServer) GetRepoArchive(*GetRepoArchiveRequest, grpc.ServerStreamingServer[GetRepoArchiveResponse]) error {
|
||||
return status.Error(codes.Unimplemented, "method GetRepoArchive not implemented")
|
||||
}
|
||||
@@ -891,24 +869,6 @@ func _ForgeService_GitCredential_Handler(srv interface{}, ctx context.Context, d
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ForgeService_ParseWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ParseWebhookRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ForgeServiceServer).ParseWebhook(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ForgeService_ParseWebhook_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ForgeServiceServer).ParseWebhook(ctx, req.(*ParseWebhookRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ForgeService_GetRepoArchive_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(GetRepoArchiveRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
@@ -1015,10 +975,6 @@ var ForgeService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GitCredential",
|
||||
Handler: _ForgeService_GitCredential_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ParseWebhook",
|
||||
Handler: _ForgeService_ParseWebhook_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user