Skip to content

Commit 0be2033

Browse files
committed
Recognize the write:org OAuth scope as satisfying read:org
If someone pastes a PAT with `write:org` scope, this avoids the error complaining that the token doesn't have `read:org` permissions. On GitHub, `write:org` implies `read:org`.
1 parent 4e5aa91 commit 0be2033

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

api/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (c Client) HasMinimumScopes(hostname string) error {
216216
missingScopes = append(missingScopes, "repo")
217217
}
218218

219-
if !search["read:org"] && !search["admin:org"] {
219+
if !search["read:org"] && !search["write:org"] && !search["admin:org"] {
220220
missingScopes = append(missingScopes, "read:org")
221221
}
222222

api/client_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ func Test_HasMinimumScopes(t *testing.T) {
131131
header: "repo, admin:org",
132132
wantErr: "",
133133
},
134+
{
135+
name: "write:org satisfies read:org",
136+
header: "repo, write:org",
137+
wantErr: "",
138+
},
134139
{
135140
name: "insufficient scope",
136141
header: "repo",

0 commit comments

Comments
 (0)