|
1 | 1 | import * as vscode from "vscode"; |
2 | 2 |
|
| 3 | +import {canReachGitHubAPI} from "./api/canReachGitHubAPI"; |
3 | 4 | import {getSession} from "./auth/auth"; |
4 | 5 | import {registerCancelWorkflowRun} from "./commands/cancelWorkflowRun"; |
5 | 6 | import {registerOpenWorkflowFile} from "./commands/openWorkflowFile"; |
@@ -32,22 +33,21 @@ import {initResources} from "./treeViews/icons"; |
32 | 33 | import {initTreeViews} from "./treeViews/treeViews"; |
33 | 34 | import {deactivateLanguageServer, initLanguageServer} from "./workflow/languageServer"; |
34 | 35 | import {registerSignIn} from "./commands/signIn"; |
35 | | -import {canReachGitHubAPI} from "./util"; |
36 | 36 |
|
37 | 37 | export async function activate(context: vscode.ExtensionContext) { |
38 | 38 | initLogger(); |
39 | 39 |
|
40 | 40 | log("Activating GitHub Actions extension..."); |
41 | 41 |
|
42 | | - const canReachAPI = await canReachGitHubAPI(); |
43 | | - const hasSession = canReachAPI && !!(await getSession()); |
| 42 | + const hasSession = !!(await getSession()); |
| 43 | + const canReachAPI = hasSession && (await canReachGitHubAPI()); |
44 | 44 |
|
45 | 45 | // Prefetch git repository origin url |
46 | 46 | const ghContext = hasSession && (await getGitHubContext()); |
47 | 47 | const hasGitHubRepos = ghContext && ghContext.repos.length > 0; |
48 | 48 |
|
49 | | - await vscode.commands.executeCommand("setContext", "github-actions.internet-access", canReachAPI); |
50 | 49 | await vscode.commands.executeCommand("setContext", "github-actions.signed-in", hasSession); |
| 50 | + await vscode.commands.executeCommand("setContext", "github-actions.internet-access", canReachAPI); |
51 | 51 | await vscode.commands.executeCommand("setContext", "github-actions.has-repos", hasGitHubRepos); |
52 | 52 |
|
53 | 53 | initResources(context); |
|
0 commit comments