The GitHub forge extension accepted every pending repository invitation, so any GitHub user could add archie's account to a repository by sending an invitation. AcceptInvitations now carries the connection's configured repositories and the extension leaves an invitation to anything else pending.
285 lines
7.4 KiB
Protocol Buffer
285 lines
7.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package forge.v1;
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
// ForgeService is the surface a forge extension serves. The host launches one
|
|
// plugin process per configured forge instance and routes every issue, pull
|
|
// request and repository call of that instance through it. The calls follow
|
|
// the host's forge interfaces; a capability the forge lacks answers
|
|
// UNIMPLEMENTED.
|
|
service ForgeService {
|
|
// Configure hands the plugin its instance once, right after launch and
|
|
// before any other call. The token is the instance's resolved credential;
|
|
// the plugin process does not inherit the host environment.
|
|
rpc Configure(ConfigureRequest) returns (ConfigureResponse);
|
|
|
|
rpc AssignedIssues(AssignedIssuesRequest) returns (AssignedIssuesResponse);
|
|
rpc IssuesWithLabel(IssuesWithLabelRequest) returns (IssuesWithLabelResponse);
|
|
rpc Comment(CommentRequest) returns (CommentResponse);
|
|
rpc CloseIssue(CloseIssueRequest) returns (CloseIssueResponse);
|
|
rpc React(ReactRequest) returns (ReactResponse);
|
|
rpc SetStateLabel(SetStateLabelRequest) returns (SetStateLabelResponse);
|
|
|
|
rpc CreatePR(CreatePRRequest) returns (CreatePRResponse);
|
|
rpc PRState(PRStateRequest) returns (PRStateResponse);
|
|
rpc ClosePR(ClosePRRequest) returns (ClosePRResponse);
|
|
rpc MergePR(MergePRRequest) returns (MergePRResponse);
|
|
rpc GetPullRequest(GetPullRequestRequest) returns (GetPullRequestResponse);
|
|
rpc GetPullRequestDiff(GetPullRequestDiffRequest) returns (GetPullRequestDiffResponse);
|
|
rpc ListReviews(ListReviewsRequest) returns (ListReviewsResponse);
|
|
rpc ListReviewComments(ListReviewCommentsRequest) returns (ListReviewCommentsResponse);
|
|
rpc ReplyToReview(ReplyToReviewRequest) returns (ReplyToReviewResponse);
|
|
rpc CreateReviewComments(CreateReviewCommentsRequest) returns (CreateReviewCommentsResponse);
|
|
|
|
rpc AcceptInvitations(AcceptInvitationsRequest) returns (AcceptInvitationsResponse);
|
|
rpc VerifyPush(VerifyPushRequest) returns (VerifyPushResponse);
|
|
rpc LinkBranch(LinkBranchRequest) returns (LinkBranchResponse);
|
|
// 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.
|
|
rpc ParseWebhook(ParseWebhookRequest) returns (ParseWebhookResponse);
|
|
// GetRepoArchive streams a gzipped tar of the repository at a ref.
|
|
rpc GetRepoArchive(GetRepoArchiveRequest) returns (stream GetRepoArchiveResponse);
|
|
}
|
|
|
|
message ConfigureRequest {
|
|
string host = 1;
|
|
string token = 2;
|
|
map<string, string> settings = 3;
|
|
}
|
|
message ConfigureResponse {}
|
|
|
|
message RepoRef {
|
|
string owner = 1;
|
|
string repo = 2;
|
|
}
|
|
|
|
message PullRequestRef {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
}
|
|
|
|
message Issue {
|
|
int32 number = 1;
|
|
string title = 2;
|
|
string body = 3;
|
|
repeated string labels = 4;
|
|
}
|
|
message AssignedIssuesResponse { repeated Issue issues = 1; }
|
|
message IssuesWithLabelResponse { repeated Issue issues = 1; }
|
|
|
|
message AssignedIssuesRequest {
|
|
RepoRef repo = 1;
|
|
string assignee = 2;
|
|
}
|
|
message IssuesWithLabelRequest {
|
|
RepoRef repo = 1;
|
|
string label = 2;
|
|
}
|
|
|
|
message CommentRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
string body = 3;
|
|
}
|
|
message CommentResponse { int64 id = 1; }
|
|
|
|
message CloseIssueRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
string comment = 3;
|
|
}
|
|
message CloseIssueResponse {}
|
|
|
|
// ClosePRRequest closes a pull request without merging, after posting
|
|
// comment when it is not empty.
|
|
message ClosePRRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
string comment = 3;
|
|
}
|
|
message ClosePRResponse {}
|
|
|
|
// MergePRRequest merges a pull request with the forge's default method.
|
|
message MergePRRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
}
|
|
message MergePRResponse {}
|
|
|
|
message ReactRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
string reaction = 3;
|
|
}
|
|
message ReactResponse {}
|
|
|
|
message SetStateLabelRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
string label = 3;
|
|
repeated string known_labels = 4;
|
|
}
|
|
message SetStateLabelResponse {}
|
|
|
|
message CreatePRRequest {
|
|
RepoRef repo = 1;
|
|
string title = 2;
|
|
string head = 3;
|
|
string base = 4;
|
|
string body = 5;
|
|
}
|
|
message CreatePRResponse { int32 number = 1; }
|
|
|
|
message PRStateRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
}
|
|
message PRStateResponse { string state = 1; }
|
|
|
|
message PullRequest {
|
|
int32 number = 1;
|
|
string title = 2;
|
|
string body = 3;
|
|
string head_ref = 4;
|
|
string base_ref = 5;
|
|
string head_sha = 6;
|
|
string base_sha = 7;
|
|
string state = 8;
|
|
}
|
|
|
|
message GetPullRequestRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
}
|
|
message GetPullRequestResponse { PullRequest pull_request = 1; }
|
|
|
|
message GetPullRequestDiffRequest {
|
|
RepoRef repo = 1;
|
|
int32 number = 2;
|
|
}
|
|
message GetPullRequestDiffResponse { string diff = 1; }
|
|
|
|
message ListReviewsRequest {
|
|
PullRequestRef pull_request = 1;
|
|
int64 since_id = 2;
|
|
}
|
|
|
|
message Review {
|
|
int64 id = 1;
|
|
string author = 2;
|
|
string state = 3;
|
|
string body = 4;
|
|
google.protobuf.Timestamp submitted_at = 5;
|
|
}
|
|
message ListReviewsResponse { repeated Review reviews = 1; }
|
|
|
|
message ReviewComment {
|
|
int64 id = 1;
|
|
int64 review_id = 2;
|
|
string author = 3;
|
|
string body = 4;
|
|
string path = 5;
|
|
int32 line = 6;
|
|
int64 in_reply_to = 7;
|
|
google.protobuf.Timestamp created_at = 8;
|
|
}
|
|
message ListReviewCommentsRequest {
|
|
PullRequestRef pull_request = 1;
|
|
int64 since_id = 2;
|
|
}
|
|
message ListReviewCommentsResponse { repeated ReviewComment comments = 1; }
|
|
|
|
message ReplyToReviewRequest {
|
|
PullRequestRef pull_request = 1;
|
|
int64 comment_id = 2;
|
|
string body = 3;
|
|
}
|
|
message ReplyToReviewResponse {}
|
|
|
|
message InlineReviewComment {
|
|
string path = 1;
|
|
int32 line = 2;
|
|
string body = 3;
|
|
}
|
|
message CreateReviewCommentsRequest {
|
|
PullRequestRef pull_request = 1;
|
|
string reviewed_head_sha = 2;
|
|
repeated InlineReviewComment comments = 3;
|
|
// COMMENT or REQUEST_CHANGES; empty means COMMENT.
|
|
string event = 4;
|
|
// Review body, listing findings that have no line anchor.
|
|
string body = 5;
|
|
}
|
|
message CreateReviewCommentsResponse {}
|
|
|
|
message LinkBranchRequest {
|
|
RepoRef repo = 1;
|
|
int32 issue_number = 2;
|
|
string branch = 3;
|
|
}
|
|
message LinkBranchResponse {}
|
|
|
|
// AcceptInvitationsRequest carries the repositories the operator configured
|
|
// this connection for. Only invitations to these are accepted; an invitation
|
|
// to anything else stays pending.
|
|
message AcceptInvitationsRequest { repeated RepoRef repositories = 1; }
|
|
message AcceptInvitationsResponse {}
|
|
|
|
message VerifyPushRequest { RepoRef repo = 1; }
|
|
message VerifyPushResponse {}
|
|
|
|
message GetRepoArchiveRequest {
|
|
RepoRef repo = 1;
|
|
string ref = 2;
|
|
}
|
|
message GetRepoArchiveResponse { bytes data = 1; }
|
|
|
|
message ParseWebhookRequest {
|
|
map<string, string> headers = 1;
|
|
bytes body = 2;
|
|
}
|
|
message ParseWebhookResponse {
|
|
oneof event {
|
|
IssueEvent issue = 1;
|
|
ReviewEvent review = 2;
|
|
ReviewCommentEvent review_comment = 3;
|
|
}
|
|
}
|
|
|
|
message IssueEvent {
|
|
string action = 1;
|
|
string state = 2;
|
|
bool is_pull_request = 3;
|
|
RepoRef repo = 4;
|
|
int32 number = 5;
|
|
string title = 6;
|
|
string body = 7;
|
|
repeated string labels = 8;
|
|
repeated string assignees = 9;
|
|
}
|
|
|
|
message ReviewEvent {
|
|
string action = 1;
|
|
RepoRef repo = 2;
|
|
int32 pr_number = 3;
|
|
int64 review_id = 4;
|
|
string author = 5;
|
|
string state = 6;
|
|
string body = 7;
|
|
}
|
|
|
|
message ReviewCommentEvent {
|
|
string action = 1;
|
|
RepoRef repo = 2;
|
|
int32 pr_number = 3;
|
|
int64 review_id = 4;
|
|
int64 comment_id = 5;
|
|
string author = 6;
|
|
string body = 7;
|
|
string path = 8;
|
|
int32 line = 9;
|
|
}
|