Skip to content

Commit 2f7f3ab

Browse files
committed
Apply lockdown mode to issues and pull requests
1 parent 2f64ac0 commit 2f7f3ab

File tree

5 files changed

+104
-47
lines changed

5 files changed

+104
-47
lines changed

pkg/github/issues.go

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,11 @@ Options are:
299299
case "get":
300300
return GetIssue(ctx, client, gqlClient, owner, repo, issueNumber, flags)
301301
case "get_comments":
302-
return GetIssueComments(ctx, client, owner, repo, issueNumber, pagination, flags)
302+
return GetIssueComments(ctx, client, gqlClient, owner, repo, issueNumber, pagination, flags)
303303
case "get_sub_issues":
304-
return GetSubIssues(ctx, client, owner, repo, issueNumber, pagination, flags)
304+
return GetSubIssues(ctx, client, gqlClient, owner, repo, issueNumber, pagination, flags)
305305
case "get_labels":
306-
return GetIssueLabels(ctx, gqlClient, owner, repo, issueNumber, flags)
306+
return GetIssueLabels(ctx, gqlClient, owner, repo, issueNumber)
307307
default:
308308
return mcp.NewToolResultError(fmt.Sprintf("unknown method: %s", method)), nil
309309
}
@@ -327,11 +327,11 @@ func GetIssue(ctx context.Context, client *github.Client, gqlClient *githubv4.Cl
327327

328328
if flags.LockdownMode {
329329
if issue.User != nil {
330-
shouldRemoveContent, err := lockdown.ShouldRemoveContent(ctx, gqlClient, *issue.User.Login, owner, repo)
330+
isPrivate, hasPushAccess, err := lockdown.GetRepoAccessInfo(ctx, gqlClient, *issue.User.Login, owner, repo)
331331
if err != nil {
332332
return mcp.NewToolResultError(fmt.Sprintf("failed to check lockdown mode: %v", err)), nil
333333
}
334-
if shouldRemoveContent {
334+
if !isPrivate && !hasPushAccess {
335335
return mcp.NewToolResultError("access to issue details is restricted by lockdown mode"), nil
336336
}
337337
}
@@ -355,7 +355,7 @@ func GetIssue(ctx context.Context, client *github.Client, gqlClient *githubv4.Cl
355355
return mcp.NewToolResultText(string(r)), nil
356356
}
357357

358-
func GetIssueComments(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, pagination PaginationParams, _ FeatureFlags) (*mcp.CallToolResult, error) {
358+
func GetIssueComments(ctx context.Context, client *github.Client, gqlClient *githubv4.Client, owner string, repo string, issueNumber int, pagination PaginationParams, flags FeatureFlags) (*mcp.CallToolResult, error) {
359359
opts := &github.IssueListCommentsOptions{
360360
ListOptions: github.ListOptions{
361361
Page: pagination.Page,
@@ -376,6 +376,23 @@ func GetIssueComments(ctx context.Context, client *github.Client, owner string,
376376
}
377377
return mcp.NewToolResultError(fmt.Sprintf("failed to get issue comments: %s", string(body))), nil
378378
}
379+
if flags.LockdownMode {
380+
filteredComments := []*github.IssueComment{}
381+
for _, comment := range comments {
382+
isPrivate, hasPushAccess, err := lockdown.GetRepoAccessInfo(ctx, gqlClient, *comment.User.Login, owner, repo)
383+
if err != nil {
384+
return mcp.NewToolResultError(fmt.Sprintf("failed to check lockdown mode: %v", err)), nil
385+
}
386+
// Do not filter content for private repositories
387+
if isPrivate {
388+
break
389+
}
390+
if hasPushAccess {
391+
filteredComments = append(filteredComments, comment)
392+
}
393+
}
394+
comments = filteredComments
395+
}
379396

380397
r, err := json.Marshal(comments)
381398
if err != nil {
@@ -385,7 +402,7 @@ func GetIssueComments(ctx context.Context, client *github.Client, owner string,
385402
return mcp.NewToolResultText(string(r)), nil
386403
}
387404

388-
func GetSubIssues(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, pagination PaginationParams, _ FeatureFlags) (*mcp.CallToolResult, error) {
405+
func GetSubIssues(ctx context.Context, client *github.Client, gqlClient *githubv4.Client, owner string, repo string, issueNumber int, pagination PaginationParams, featureFlags FeatureFlags) (*mcp.CallToolResult, error) {
389406
opts := &github.IssueListOptions{
390407
ListOptions: github.ListOptions{
391408
Page: pagination.Page,
@@ -412,6 +429,24 @@ func GetSubIssues(ctx context.Context, client *github.Client, owner string, repo
412429
return mcp.NewToolResultError(fmt.Sprintf("failed to list sub-issues: %s", string(body))), nil
413430
}
414431

432+
if featureFlags.LockdownMode {
433+
filteredSubIssues := []*github.SubIssue{}
434+
for _, subIssue := range subIssues {
435+
isPrivate, hasPushAccess, err := lockdown.GetRepoAccessInfo(ctx, gqlClient, *subIssue.User.Login, owner, repo)
436+
if err != nil {
437+
return mcp.NewToolResultError(fmt.Sprintf("failed to check lockdown mode: %v", err)), nil
438+
}
439+
// Repo is private, do not filter content
440+
if isPrivate {
441+
break
442+
}
443+
if hasPushAccess {
444+
filteredSubIssues = append(filteredSubIssues, subIssue)
445+
}
446+
}
447+
subIssues = filteredSubIssues
448+
}
449+
415450
r, err := json.Marshal(subIssues)
416451
if err != nil {
417452
return nil, fmt.Errorf("failed to marshal response: %w", err)
@@ -420,7 +455,7 @@ func GetSubIssues(ctx context.Context, client *github.Client, owner string, repo
420455
return mcp.NewToolResultText(string(r)), nil
421456
}
422457

423-
func GetIssueLabels(ctx context.Context, client *githubv4.Client, owner string, repo string, issueNumber int, _ FeatureFlags) (*mcp.CallToolResult, error) {
458+
func GetIssueLabels(ctx context.Context, client *githubv4.Client, owner string, repo string, issueNumber int) (*mcp.CallToolResult, error) {
424459
// Get current labels on the issue using GraphQL
425460
var query struct {
426461
Repository struct {

pkg/github/pullrequests.go

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ import (
1414
"github.com/shurcooL/githubv4"
1515

1616
ghErrors "github.com/github/github-mcp-server/pkg/errors"
17+
"github.com/github/github-mcp-server/pkg/lockdown"
1718
"github.com/github/github-mcp-server/pkg/sanitize"
1819
"github.com/github/github-mcp-server/pkg/translations"
1920
)
2021

2122
// GetPullRequest creates a tool to get details of a specific pull request.
22-
func PullRequestRead(getClient GetClientFn, t translations.TranslationHelperFunc, flags FeatureFlags) (mcp.Tool, server.ToolHandlerFunc) {
23+
func PullRequestRead(getClient GetClientFn, getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc, flags FeatureFlags) (mcp.Tool, server.ToolHandlerFunc) {
2324
return mcp.NewTool("pull_request_read",
2425
mcp.WithDescription(t("TOOL_PULL_REQUEST_READ_DESCRIPTION", "Get information on a specific pull request in GitHub repository.")),
2526
mcp.WithToolAnnotation(mcp.ToolAnnotation{
@@ -83,29 +84,34 @@ Possible options:
8384
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
8485
}
8586

87+
gqlClient, err := getGQLClient(ctx)
88+
if err != nil {
89+
return nil, fmt.Errorf("failed to get GitHub GraphQL client: %w", err)
90+
}
91+
8692
switch method {
8793

8894
case "get":
89-
return GetPullRequest(ctx, client, owner, repo, pullNumber)
95+
return GetPullRequest(ctx, client, gqlClient, owner, repo, pullNumber, flags)
9096
case "get_diff":
9197
return GetPullRequestDiff(ctx, client, owner, repo, pullNumber)
9298
case "get_status":
9399
return GetPullRequestStatus(ctx, client, owner, repo, pullNumber)
94100
case "get_files":
95101
return GetPullRequestFiles(ctx, client, owner, repo, pullNumber, pagination)
96102
case "get_review_comments":
97-
return GetPullRequestReviewComments(ctx, client, owner, repo, pullNumber, pagination)
103+
return GetPullRequestReviewComments(ctx, client, gqlClient, owner, repo, pullNumber, pagination, flags)
98104
case "get_reviews":
99-
return GetPullRequestReviews(ctx, client, owner, repo, pullNumber)
105+
return GetPullRequestReviews(ctx, client, gqlClient, owner, repo, pullNumber, flags)
100106
case "get_comments":
101-
return GetIssueComments(ctx, client, owner, repo, pullNumber, pagination, flags)
107+
return GetIssueComments(ctx, client, gqlClient, owner, repo, pullNumber, pagination, flags)
102108
default:
103109
return nil, fmt.Errorf("unknown method: %s", method)
104110
}
105111
}
106112
}
107113

108-
func GetPullRequest(ctx context.Context, client *github.Client, owner, repo string, pullNumber int) (*mcp.CallToolResult, error) {
114+
func GetPullRequest(ctx context.Context, client *github.Client, gqlClient *githubv4.Client, owner, repo string, pullNumber int, ff FeatureFlags) (*mcp.CallToolResult, error) {
109115
pr, resp, err := client.PullRequests.Get(ctx, owner, repo, pullNumber)
110116
if err != nil {
111117
return ghErrors.NewGitHubAPIErrorResponse(ctx,
@@ -134,6 +140,17 @@ func GetPullRequest(ctx context.Context, client *github.Client, owner, repo stri
134140
}
135141
}
136142

143+
if ff.LockdownMode {
144+
isPrivate, hasPushAccess, err := lockdown.GetRepoAccessInfo(ctx, gqlClient, pr.GetUser().GetLogin(), owner, repo)
145+
if err != nil {
146+
return nil, fmt.Errorf("failed to check content removal: %w", err)
147+
}
148+
149+
if !isPrivate && !hasPushAccess {
150+
return mcp.NewToolResultError("access to pull request is restricted by lockdown mode"), nil
151+
}
152+
}
153+
137154
r, err := json.Marshal(pr)
138155
if err != nil {
139156
return nil, fmt.Errorf("failed to marshal response: %w", err)
@@ -249,7 +266,7 @@ func GetPullRequestFiles(ctx context.Context, client *github.Client, owner, repo
249266
return mcp.NewToolResultText(string(r)), nil
250267
}
251268

252-
func GetPullRequestReviewComments(ctx context.Context, client *github.Client, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error) {
269+
func GetPullRequestReviewComments(ctx context.Context, client *github.Client, gqlClient *githubv4.Client, owner, repo string, pullNumber int, pagination PaginationParams, ff FeatureFlags) (*mcp.CallToolResult, error) {
253270
opts := &github.PullRequestListCommentsOptions{
254271
ListOptions: github.ListOptions{
255272
PerPage: pagination.PerPage,
@@ -275,6 +292,16 @@ func GetPullRequestReviewComments(ctx context.Context, client *github.Client, ow
275292
return mcp.NewToolResultError(fmt.Sprintf("failed to get pull request review comments: %s", string(body))), nil
276293
}
277294

295+
if ff.LockdownMode {
296+
isPrivate, hasPushAccess, err := lockdown.GetRepoAccessInfo(ctx, gqlClient, comments[0].GetUser().GetLogin(), owner, repo)
297+
if err != nil {
298+
return nil, fmt.Errorf("failed to check content removal: %w", err)
299+
}
300+
if !isPrivate && !hasPushAccess {
301+
return mcp.NewToolResultError("access to pull request review comments is restricted by lockdown mode"), nil
302+
}
303+
}
304+
278305
r, err := json.Marshal(comments)
279306
if err != nil {
280307
return nil, fmt.Errorf("failed to marshal response: %w", err)
@@ -283,7 +310,7 @@ func GetPullRequestReviewComments(ctx context.Context, client *github.Client, ow
283310
return mcp.NewToolResultText(string(r)), nil
284311
}
285312

286-
func GetPullRequestReviews(ctx context.Context, client *github.Client, owner, repo string, pullNumber int) (*mcp.CallToolResult, error) {
313+
func GetPullRequestReviews(ctx context.Context, client *github.Client, gqlClient *githubv4.Client, owner, repo string, pullNumber int, ff FeatureFlags) (*mcp.CallToolResult, error) {
287314
reviews, resp, err := client.PullRequests.ListReviews(ctx, owner, repo, pullNumber, nil)
288315
if err != nil {
289316
return ghErrors.NewGitHubAPIErrorResponse(ctx,
@@ -302,6 +329,16 @@ func GetPullRequestReviews(ctx context.Context, client *github.Client, owner, re
302329
return mcp.NewToolResultError(fmt.Sprintf("failed to get pull request reviews: %s", string(body))), nil
303330
}
304331

332+
if ff.LockdownMode {
333+
isPrivate, hasPushAccess, err := lockdown.GetRepoAccessInfo(ctx, gqlClient, reviews[0].GetUser().GetLogin(), owner, repo)
334+
if err != nil {
335+
return nil, fmt.Errorf("failed to check content removal: %w", err)
336+
}
337+
if !isPrivate && !hasPushAccess {
338+
return mcp.NewToolResultError("access to pull request reviews is restricted by lockdown mode"), nil
339+
}
340+
}
341+
305342
r, err := json.Marshal(reviews)
306343
if err != nil {
307344
return nil, fmt.Errorf("failed to marshal response: %w", err)

pkg/github/pullrequests_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
func Test_GetPullRequest(t *testing.T) {
2222
// Verify tool definition once
2323
mockClient := github.NewClient(nil)
24-
tool, _ := PullRequestRead(stubGetClientFn(mockClient), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
24+
tool, _ := PullRequestRead(stubGetClientFn(mockClient), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
2525
require.NoError(t, toolsnaps.Test(tool.Name, tool))
2626

2727
assert.Equal(t, "pull_request_read", tool.Name)
@@ -102,7 +102,7 @@ func Test_GetPullRequest(t *testing.T) {
102102
t.Run(tc.name, func(t *testing.T) {
103103
// Setup client with mock
104104
client := github.NewClient(tc.mockedClient)
105-
_, handler := PullRequestRead(stubGetClientFn(client), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
105+
_, handler := PullRequestRead(stubGetClientFn(client), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
106106

107107
// Create call request
108108
request := createMCPRequest(tc.requestArgs)
@@ -1133,7 +1133,7 @@ func Test_SearchPullRequests(t *testing.T) {
11331133
func Test_GetPullRequestFiles(t *testing.T) {
11341134
// Verify tool definition once
11351135
mockClient := github.NewClient(nil)
1136-
tool, _ := PullRequestRead(stubGetClientFn(mockClient), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1136+
tool, _ := PullRequestRead(stubGetClientFn(mockClient), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
11371137
require.NoError(t, toolsnaps.Test(tool.Name, tool))
11381138

11391139
assert.Equal(t, "pull_request_read", tool.Name)
@@ -1236,7 +1236,7 @@ func Test_GetPullRequestFiles(t *testing.T) {
12361236
t.Run(tc.name, func(t *testing.T) {
12371237
// Setup client with mock
12381238
client := github.NewClient(tc.mockedClient)
1239-
_, handler := PullRequestRead(stubGetClientFn(client), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1239+
_, handler := PullRequestRead(stubGetClientFn(client), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
12401240

12411241
// Create call request
12421242
request := createMCPRequest(tc.requestArgs)
@@ -1277,7 +1277,7 @@ func Test_GetPullRequestFiles(t *testing.T) {
12771277
func Test_GetPullRequestStatus(t *testing.T) {
12781278
// Verify tool definition once
12791279
mockClient := github.NewClient(nil)
1280-
tool, _ := PullRequestRead(stubGetClientFn(mockClient), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1280+
tool, _ := PullRequestRead(stubGetClientFn(mockClient), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
12811281
require.NoError(t, toolsnaps.Test(tool.Name, tool))
12821282

12831283
assert.Equal(t, "pull_request_read", tool.Name)
@@ -1404,7 +1404,7 @@ func Test_GetPullRequestStatus(t *testing.T) {
14041404
t.Run(tc.name, func(t *testing.T) {
14051405
// Setup client with mock
14061406
client := github.NewClient(tc.mockedClient)
1407-
_, handler := PullRequestRead(stubGetClientFn(client), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1407+
_, handler := PullRequestRead(stubGetClientFn(client), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
14081408

14091409
// Create call request
14101410
request := createMCPRequest(tc.requestArgs)
@@ -1566,7 +1566,7 @@ func Test_UpdatePullRequestBranch(t *testing.T) {
15661566
func Test_GetPullRequestComments(t *testing.T) {
15671567
// Verify tool definition once
15681568
mockClient := github.NewClient(nil)
1569-
tool, _ := PullRequestRead(stubGetClientFn(mockClient), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1569+
tool, _ := PullRequestRead(stubGetClientFn(mockClient), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
15701570
require.NoError(t, toolsnaps.Test(tool.Name, tool))
15711571

15721572
assert.Equal(t, "pull_request_read", tool.Name)
@@ -1658,7 +1658,7 @@ func Test_GetPullRequestComments(t *testing.T) {
16581658
t.Run(tc.name, func(t *testing.T) {
16591659
// Setup client with mock
16601660
client := github.NewClient(tc.mockedClient)
1661-
_, handler := PullRequestRead(stubGetClientFn(client), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1661+
_, handler := PullRequestRead(stubGetClientFn(client), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
16621662

16631663
// Create call request
16641664
request := createMCPRequest(tc.requestArgs)
@@ -1700,7 +1700,7 @@ func Test_GetPullRequestComments(t *testing.T) {
17001700
func Test_GetPullRequestReviews(t *testing.T) {
17011701
// Verify tool definition once
17021702
mockClient := github.NewClient(nil)
1703-
tool, _ := PullRequestRead(stubGetClientFn(mockClient), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1703+
tool, _ := PullRequestRead(stubGetClientFn(mockClient), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
17041704
require.NoError(t, toolsnaps.Test(tool.Name, tool))
17051705

17061706
assert.Equal(t, "pull_request_read", tool.Name)
@@ -1788,7 +1788,7 @@ func Test_GetPullRequestReviews(t *testing.T) {
17881788
t.Run(tc.name, func(t *testing.T) {
17891789
// Setup client with mock
17901790
client := github.NewClient(tc.mockedClient)
1791-
_, handler := PullRequestRead(stubGetClientFn(client), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1791+
_, handler := PullRequestRead(stubGetClientFn(client), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
17921792

17931793
// Create call request
17941794
request := createMCPRequest(tc.requestArgs)
@@ -2789,7 +2789,7 @@ func TestGetPullRequestDiff(t *testing.T) {
27892789

27902790
// Verify tool definition once
27912791
mockClient := github.NewClient(nil)
2792-
tool, _ := PullRequestRead(stubGetClientFn(mockClient), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
2792+
tool, _ := PullRequestRead(stubGetClientFn(mockClient), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
27932793
require.NoError(t, toolsnaps.Test(tool.Name, tool))
27942794

27952795
assert.Equal(t, "pull_request_read", tool.Name)
@@ -2847,7 +2847,7 @@ index 5d6e7b2..8a4f5c3 100644
28472847

28482848
// Setup client with mock
28492849
client := github.NewClient(tc.mockedClient)
2850-
_, handler := PullRequestRead(stubGetClientFn(client), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
2850+
_, handler := PullRequestRead(stubGetClientFn(client), stubGetGQLClientFn(githubv4.NewClient(nil)), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
28512851

28522852
// Create call request
28532853
request := createMCPRequest(tc.requestArgs)

pkg/github/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
224224
)
225225
pullRequests := toolsets.NewToolset(ToolsetMetadataPullRequests.ID, ToolsetMetadataPullRequests.Description).
226226
AddReadTools(
227-
toolsets.NewServerTool(PullRequestRead(getClient, t, flags)),
227+
toolsets.NewServerTool(PullRequestRead(getClient, getGQLClient, t, flags)),
228228
toolsets.NewServerTool(ListPullRequests(getClient, t)),
229229
toolsets.NewServerTool(SearchPullRequests(getClient, t)),
230230
).

pkg/lockdown/lockdown.go

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,9 @@ import (
88
"github.com/shurcooL/githubv4"
99
)
1010

11-
// ShouldRemoveContent determines if content should be removed based on
12-
// lockdown mode rules. It checks if the repository is private and if the user
13-
// has push access to the repository.
14-
func ShouldRemoveContent(ctx context.Context, client *githubv4.Client, username, owner, repo string) (bool, error) {
15-
isPrivate, hasPushAccess, err := repoAccessInfo(ctx, client, username, owner, repo)
16-
if err != nil {
17-
return false, err
18-
}
19-
20-
// Do not filter content for private repositories
21-
if isPrivate {
22-
return false, nil
23-
}
24-
25-
return !hasPushAccess, nil
26-
}
27-
28-
func repoAccessInfo(ctx context.Context, client *githubv4.Client, username, owner, repo string) (bool, bool, error) {
11+
// GetRepoAccessInfo retrieves whether the repository is private and whether
12+
// the user has push access to the repository.
13+
func GetRepoAccessInfo(ctx context.Context, client *githubv4.Client, username, owner, repo string) (bool, bool, error) {
2914
if client == nil {
3015
return false, false, fmt.Errorf("nil GraphQL client")
3116
}

0 commit comments

Comments
 (0)