Skip to content

Commit 4d5cae9

Browse files
Crystal Tennlrotschy
andcommitted
Set all contexts for view upon sign in
Co-authored-by: Liela Rotschy <lrotschy@github.com>
1 parent a1b382a commit 4d5cae9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/commands/signIn.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import * as vscode from "vscode";
22
import {getSession} from "../auth/auth";
3+
import {canReachGitHubAPI} from "../api/canReachGitHubAPI";
4+
import {getGitHubContext} from "../git/repository";
35

46
export function registerSignIn(context: vscode.ExtensionContext) {
57
context.subscriptions.push(
68
vscode.commands.registerCommand("github-actions.sign-in", async () => {
79
const session = await getSession(true);
810
if (session) {
11+
const canReachAPI = await canReachGitHubAPI();
12+
const ghContext = await getGitHubContext();
13+
const hasGitHubRepos = ghContext && ghContext.repos.length > 0;
14+
915
await vscode.commands.executeCommand("setContext", "github-actions.signed-in", true);
16+
await vscode.commands.executeCommand("setContext", "github-actions.internet-access", canReachAPI);
17+
await vscode.commands.executeCommand("setContext", "github-actions.has-repos", hasGitHubRepos);
1018
}
1119
})
1220
);

0 commit comments

Comments
 (0)