Skip to content

Commit 649698e

Browse files
committed
Add prettier fixes only
1 parent af9e73e commit 649698e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+386
-755
lines changed

src/auth/auth.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import * as vscode from "vscode";
22

3-
import {
4-
orgFeaturesEnabled,
5-
updateOrgFeaturesEnabled
6-
} from "../configuration/configuration";
3+
import { orgFeaturesEnabled, updateOrgFeaturesEnabled } from "../configuration/configuration";
74

85
import { resetGitHubContext } from "../git/repository";
96

@@ -17,23 +14,17 @@ export function registerListeners(context: vscode.ExtensionContext): void {
1714
if (e.provider.id === AUTH_PROVIDER_ID) {
1815
await enableOrgFeatures();
1916
}
20-
})
17+
}),
2118
);
2219
}
2320

2421
export async function getSession(): Promise<vscode.AuthenticationSession> {
25-
const existingSession = await vscode.authentication.getSession(
26-
AUTH_PROVIDER_ID,
27-
getScopes(),
28-
{
29-
createIfNone: true,
30-
}
31-
);
22+
const existingSession = await vscode.authentication.getSession(AUTH_PROVIDER_ID, getScopes(), {
23+
createIfNone: true,
24+
});
3225

3326
if (!existingSession) {
34-
throw new Error(
35-
"Could not get token from the GitHub authentication provider. \nPlease sign-in and allow access."
36-
);
27+
throw new Error("Could not get token from the GitHub authentication provider. \nPlease sign-in and allow access.");
3728
}
3829

3930
return existingSession;

src/commands/cancelWorkflowRun.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ export function registerCancelWorkflowRun(context: vscode.ExtensionContext) {
2222
run_id: run.id,
2323
});
2424
} catch (e: any) {
25-
vscode.window.showErrorMessage(
26-
`Could not cancel workflow: '${e.message}'`
27-
);
25+
vscode.window.showErrorMessage(`Could not cancel workflow: '${e.message}'`);
2826
}
2927

3028
vscode.commands.executeCommand("github-actions.explorer.refresh");
31-
}
32-
)
29+
},
30+
),
3331
);
3432
}

src/commands/openWorkflowFile.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ export function registerOpenWorkflowFile(context: vscode.ExtensionContext) {
2424
}
2525

2626
// File not found in workspace
27-
vscode.window.showErrorMessage(
28-
`Workflow ${wf.path} not found in current workspace`
29-
);
30-
}
31-
)
27+
vscode.window.showErrorMessage(`Workflow ${wf.path} not found in current workspace`);
28+
},
29+
),
3230
);
3331
}

src/commands/openWorkflowRun.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ import { WorkflowRun } from "../model";
33

44
export function registerOpenWorkflowRun(context: vscode.ExtensionContext) {
55
context.subscriptions.push(
6-
vscode.commands.registerCommand(
7-
"github-actions.workflow.run.open",
8-
async (args) => {
9-
const run: WorkflowRun = args.run;
10-
const url = run.html_url;
11-
vscode.env.openExternal(vscode.Uri.parse(url));
12-
}
13-
)
6+
vscode.commands.registerCommand("github-actions.workflow.run.open", async (args) => {
7+
const run: WorkflowRun = args.run;
8+
const url = run.html_url;
9+
vscode.env.openExternal(vscode.Uri.parse(url));
10+
}),
1411
);
1512
}

src/commands/openWorkflowRunLogs.ts

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,55 +13,45 @@ export interface OpenWorkflowRunLogsCommandArgs {
1313

1414
export function registerOpenWorkflowRunLogs(context: vscode.ExtensionContext) {
1515
context.subscriptions.push(
16-
vscode.commands.registerCommand(
17-
"github-actions.workflow.logs",
18-
async (args: OpenWorkflowRunLogsCommandArgs) => {
19-
const gitHubRepoContext = args.gitHubRepoContext;
20-
const job = args.job;
21-
const step = args.step;
22-
const uri = buildLogURI(
23-
`%23${job.run_id} - ${job.name}`,
24-
gitHubRepoContext.owner,
25-
gitHubRepoContext.name,
26-
job.id
27-
);
16+
vscode.commands.registerCommand("github-actions.workflow.logs", async (args: OpenWorkflowRunLogsCommandArgs) => {
17+
const gitHubRepoContext = args.gitHubRepoContext;
18+
const job = args.job;
19+
const step = args.step;
20+
const uri = buildLogURI(
21+
`%23${job.run_id} - ${job.name}`,
22+
gitHubRepoContext.owner,
23+
gitHubRepoContext.name,
24+
job.id,
25+
);
2826

29-
const doc = await vscode.workspace.openTextDocument(uri);
30-
const editor = await vscode.window.showTextDocument(doc, {
31-
preview: false,
32-
});
27+
const doc = await vscode.workspace.openTextDocument(uri);
28+
const editor = await vscode.window.showTextDocument(doc, {
29+
preview: false,
30+
});
3331

34-
const logInfo = getLogInfo(uri);
35-
if (!logInfo) {
36-
throw new Error("Could not get log info");
37-
}
32+
const logInfo = getLogInfo(uri);
33+
if (!logInfo) {
34+
throw new Error("Could not get log info");
35+
}
3836

39-
// Custom formatting after the editor has been opened
40-
updateDecorations(editor, logInfo);
37+
// Custom formatting after the editor has been opened
38+
updateDecorations(editor, logInfo);
4139

42-
// Deep linking to steps
43-
if (step) {
44-
let matchingSection = logInfo.sections.find(
45-
(s) => s.name && s.name === step.name
46-
);
47-
if (!matchingSection) {
48-
// If we cannot match by name, see if we can try to match by number
49-
matchingSection = logInfo.sections[step.number - 1];
50-
}
40+
// Deep linking to steps
41+
if (step) {
42+
let matchingSection = logInfo.sections.find((s) => s.name && s.name === step.name);
43+
if (!matchingSection) {
44+
// If we cannot match by name, see if we can try to match by number
45+
matchingSection = logInfo.sections[step.number - 1];
46+
}
5147

52-
if (matchingSection) {
53-
editor.revealRange(
54-
new vscode.Range(
55-
matchingSection.start,
56-
0,
57-
matchingSection.start,
58-
0
59-
),
60-
vscode.TextEditorRevealType.InCenter
61-
);
62-
}
48+
if (matchingSection) {
49+
editor.revealRange(
50+
new vscode.Range(matchingSection.start, 0, matchingSection.start, 0),
51+
vscode.TextEditorRevealType.InCenter,
52+
);
6353
}
6454
}
65-
)
55+
}),
6656
);
6757
}

src/commands/orgLogin.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import { enableOrgFeatures } from "../auth/auth";
44

55
export function registerOrgLogin(context: vscode.ExtensionContext) {
66
context.subscriptions.push(
7-
vscode.commands.registerCommand(
8-
"github-actions.auth.org-login",
9-
async () => {
10-
enableOrgFeatures();
11-
}
12-
)
7+
vscode.commands.registerCommand("github-actions.auth.org-login", async () => {
8+
enableOrgFeatures();
9+
}),
1310
);
1411
}

src/commands/pinWorkflow.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,23 @@ interface PinWorkflowCommandOptions {
1414

1515
export function registerPinWorkflow(context: vscode.ExtensionContext) {
1616
context.subscriptions.push(
17-
vscode.commands.registerCommand(
18-
"github-actions.workflow.pin",
19-
async (args: PinWorkflowCommandOptions) => {
20-
const { gitHubRepoContext, wf } = args;
21-
22-
if (!wf) {
23-
return;
24-
}
25-
26-
const workflowFullPath = getWorkflowUri(gitHubRepoContext, wf.path);
27-
if (!workflowFullPath) {
28-
return;
29-
}
30-
31-
const relativeWorkflowPath =
32-
vscode.workspace.asRelativePath(workflowFullPath);
33-
await pinWorkflow(relativeWorkflowPath);
34-
35-
args.updateContextValue();
36-
vscode.commands.executeCommand("github-actions.explorer.refresh");
17+
vscode.commands.registerCommand("github-actions.workflow.pin", async (args: PinWorkflowCommandOptions) => {
18+
const { gitHubRepoContext, wf } = args;
19+
20+
if (!wf) {
21+
return;
22+
}
23+
24+
const workflowFullPath = getWorkflowUri(gitHubRepoContext, wf.path);
25+
if (!workflowFullPath) {
26+
return;
3727
}
38-
)
28+
29+
const relativeWorkflowPath = vscode.workspace.asRelativePath(workflowFullPath);
30+
await pinWorkflow(relativeWorkflowPath);
31+
32+
args.updateContextValue();
33+
vscode.commands.executeCommand("github-actions.explorer.refresh");
34+
}),
3935
);
4036
}

src/commands/rerunWorkflowRun.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ export function registerReRunWorkflowRun(context: vscode.ExtensionContext) {
2323
run_id: run.id,
2424
});
2525
} catch (e: any) {
26-
vscode.window.showErrorMessage(
27-
`Could not rerun workflow: '${e.message}'`
28-
);
26+
vscode.window.showErrorMessage(`Could not rerun workflow: '${e.message}'`);
2927
}
3028

3129
vscode.commands.executeCommand("github-actions.explorer.refresh");
32-
}
33-
)
30+
},
31+
),
3432
);
3533
}

src/commands/secrets/addSecret.ts

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,44 @@ interface AddSecretCommandArgs {
88

99
export function registerAddSecret(context: vscode.ExtensionContext) {
1010
context.subscriptions.push(
11-
vscode.commands.registerCommand(
12-
"github-actions.settings.secret.add",
13-
async (args: AddSecretCommandArgs) => {
14-
const gitHubContext = args.gitHubRepoContext;
11+
vscode.commands.registerCommand("github-actions.settings.secret.add", async (args: AddSecretCommandArgs) => {
12+
const gitHubContext = args.gitHubRepoContext;
1513

16-
const name = await vscode.window.showInputBox({
17-
prompt: "Enter name for new secret",
18-
});
14+
const name = await vscode.window.showInputBox({
15+
prompt: "Enter name for new secret",
16+
});
1917

20-
if (!name) {
21-
return;
22-
}
18+
if (!name) {
19+
return;
20+
}
2321

24-
const value = await vscode.window.showInputBox({
25-
prompt: "Enter the new secret value",
26-
});
27-
28-
if (value) {
29-
try {
30-
const keyResponse =
31-
await gitHubContext.client.actions.getRepoPublicKey({
32-
owner: gitHubContext.owner,
33-
repo: gitHubContext.name,
34-
});
35-
36-
const key_id = keyResponse.data.key_id;
37-
const key = keyResponse.data.key;
38-
39-
await gitHubContext.client.actions.createOrUpdateRepoSecret({
40-
owner: gitHubContext.owner,
41-
repo: gitHubContext.name,
42-
secret_name: name,
43-
key_id: key_id,
44-
encrypted_value: encodeSecret(key, value),
45-
});
46-
} catch (e: any) {
47-
vscode.window.showErrorMessage(e.message);
48-
}
22+
const value = await vscode.window.showInputBox({
23+
prompt: "Enter the new secret value",
24+
});
25+
26+
if (value) {
27+
try {
28+
const keyResponse = await gitHubContext.client.actions.getRepoPublicKey({
29+
owner: gitHubContext.owner,
30+
repo: gitHubContext.name,
31+
});
32+
33+
const key_id = keyResponse.data.key_id;
34+
const key = keyResponse.data.key;
35+
36+
await gitHubContext.client.actions.createOrUpdateRepoSecret({
37+
owner: gitHubContext.owner,
38+
repo: gitHubContext.name,
39+
secret_name: name,
40+
key_id: key_id,
41+
encrypted_value: encodeSecret(key, value),
42+
});
43+
} catch (e: any) {
44+
vscode.window.showErrorMessage(e.message);
4945
}
50-
51-
vscode.commands.executeCommand("github-actions.explorer.refresh");
5246
}
53-
)
47+
48+
vscode.commands.executeCommand("github-actions.explorer.refresh");
49+
}),
5450
);
5551
}

src/commands/secrets/copySecret.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@ interface CopySecretCommandArgs {
99

1010
export function registerCopySecret(context: vscode.ExtensionContext) {
1111
context.subscriptions.push(
12-
vscode.commands.registerCommand(
13-
"github-actions.settings.secret.copy",
14-
async (args: CopySecretCommandArgs) => {
15-
const { secret } = args;
12+
vscode.commands.registerCommand("github-actions.settings.secret.copy", async (args: CopySecretCommandArgs) => {
13+
const { secret } = args;
1614

17-
vscode.env.clipboard.writeText(secret.name);
15+
vscode.env.clipboard.writeText(secret.name);
1816

19-
vscode.window.setStatusBarMessage(`Copied ${secret.name}`, 2000);
20-
}
21-
)
17+
vscode.window.setStatusBarMessage(`Copied ${secret.name}`, 2000);
18+
}),
2219
);
2320
}

0 commit comments

Comments
 (0)