-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapi.go
More file actions
61 lines (52 loc) · 1.81 KB
/
Copy pathapi.go
File metadata and controls
61 lines (52 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package github
import (
"context"
"github.com/google/go-github/v50/github"
pe "github.com/marqeta/pr-bot/errors"
"github.com/marqeta/pr-bot/id"
"github.com/shurcooL/githubv4"
)
const (
Approve = "APPROVE"
RequestChanges = "REQUEST_CHANGES"
Comment = "COMMENT"
LGTM = "LGTM! :rocket: :tada: :100:"
ApprovalTemplate = `
<details>
<summary>
%v
<br/>
More details on PR bot policy evaluation: <a href="%v">link</a>
</summary>
~~~json
%v
~~~
</details>
`
ErrorTemplate = `
<details>
<summary>:warning: %v :warning: </summary>
~~~json
%v
~~~
</details>
`
)
//go:generate mockery --name API
type API interface {
ListReviews(ctx context.Context, id id.PR) ([]*github.PullRequestReview, error)
AddReview(ctx context.Context, id id.PR, summary, event string) error
DismissReview(ctx context.Context, id id.PR, reviewID int64, message string) error
EnableAutoMerge(ctx context.Context, id id.PR, method githubv4.PullRequestMergeMethod) error
IssueComment(ctx context.Context, id id.PR, comment string) error
IssueCommentForError(ctx context.Context, id id.PR, err pe.APIError) error
ListAllTopics(ctx context.Context, id id.PR) ([]string, error)
ListRequiredStatusChecks(ctx context.Context, id id.PR, branch string) ([]string, error)
ListFilesInRootDir(ctx context.Context, id id.PR, branch string) ([]string, error)
ListFilesChangedInPR(ctx context.Context, id id.PR) ([]*github.CommitFile, error)
GetBranchProtection(ctx context.Context, id id.PR, branch string) (*github.Protection, error)
ListNamesOfFilesChangedInPR(ctx context.Context, id id.PR) ([]string, error)
GetPullRequest(ctx context.Context, id id.PR) (*github.PullRequest, error)
GetRepository(ctx context.Context, id id.PR) (*github.Repository, error)
GetOrganization(ctx context.Context, id id.PR) (*github.Organization, error)
}