From 51f5e52da09fa415c18ff0635ef033a093b86532 Mon Sep 17 00:00:00 2001 From: Reinier Cruz Date: Fri, 2 Aug 2024 19:31:21 +0000 Subject: [PATCH 1/2] Updated github auth scope to repo --- src/commands/draft/draftCommands.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/commands/draft/draftCommands.ts b/src/commands/draft/draftCommands.ts index 5423d3d74..297727eda 100644 --- a/src/commands/draft/draftCommands.ts +++ b/src/commands/draft/draftCommands.ts @@ -214,8 +214,8 @@ type DraftDependencies = { async function getGitHubAuthenticationSession(): Promise> { try { - // No special scopes are required for GitHub - we are just listing repositories/branches. - const scopes: string[] = []; + // Repo scope required to see public/private repos. + const scopes: string[] = ["repo"]; const session = await authentication.getSession("github", scopes, { createIfNone: true }); return { succeeded: true, result: session }; } catch (e) { @@ -229,13 +229,12 @@ async function getRepo(octokit: Octokit, remote: Remote): Promise Date: Tue, 6 Aug 2024 14:02:54 +0000 Subject: [PATCH 2/2] Adding scope reference doc comment --- src/commands/draft/draftCommands.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/draft/draftCommands.ts b/src/commands/draft/draftCommands.ts index 297727eda..800a6110b 100644 --- a/src/commands/draft/draftCommands.ts +++ b/src/commands/draft/draftCommands.ts @@ -215,6 +215,7 @@ type DraftDependencies = { async function getGitHubAuthenticationSession(): Promise> { try { // Repo scope required to see public/private repos. + // Reference for Github scopes: https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps const scopes: string[] = ["repo"]; const session = await authentication.getSession("github", scopes, { createIfNone: true }); return { succeeded: true, result: session };