forked from github/vscode-github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrerunWorkflowRun.ts
33 lines (28 loc) · 995 Bytes
/
rerunWorkflowRun.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import * as vscode from "vscode";
import {GitHubRepoContext} from "../git/repository";
import {WorkflowRun} from "../model";
interface ReRunWorkflowRunLogsCommandArgs {
gitHubRepoContext: GitHubRepoContext;
run: WorkflowRun;
}
export function registerReRunWorkflowRun(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand(
"github-actions.workflow.run.rerun",
async (args: ReRunWorkflowRunLogsCommandArgs) => {
const gitHubContext = args.gitHubRepoContext;
const run = args.run;
try {
await gitHubContext.client.actions.reRunWorkflow({
owner: gitHubContext.owner,
repo: gitHubContext.name,
run_id: run.id
});
} catch (e) {
await vscode.window.showErrorMessage(`Could not rerun workflow: '${(e as Error).message}'`);
}
await vscode.commands.executeCommand("github-actions.explorer.refresh");
}
)
);
}