Skip to content

Commit c824ef5

Browse files
committed
Avoid blocking extension activation in sign in
1 parent 0a9a261 commit c824ef5

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

src/auth/auth.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,23 @@ export async function getSession(): Promise<vscode.AuthenticationSession | undef
3232

3333
signInPrompted = true;
3434
const signInAction = "Sign in to GitHub";
35-
const result = await vscode.window.showInformationMessage(
36-
"Sign in to GitHub to access your repositories and GitHub Actions workflows.",
37-
signInAction
38-
);
39-
if (result === signInAction) {
40-
return await getSessionInternal(true);
41-
}
35+
vscode.window
36+
.showInformationMessage("Sign in to GitHub to access your repositories and GitHub Actions workflows.", signInAction)
37+
.then(
38+
async result => {
39+
if (result === signInAction) {
40+
const session = await getSessionInternal(true);
41+
if (session) {
42+
await vscode.commands.executeCommand("setContext", "github-actions.signed-in", true);
43+
}
44+
}
45+
},
46+
() => {
47+
// Ignore rejected promise
48+
}
49+
);
4250

43-
// User chose to not sign in
51+
// User chose to not sign in or hasn't signed in yet
4452
return undefined;
4553
}
4654

0 commit comments

Comments
 (0)