Add message to update act command
Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
31
src/act.ts
31
src/act.ts
@@ -2,7 +2,7 @@ import * as childProcess from "child_process";
|
|||||||
import * as fs from "fs/promises";
|
import * as fs from "fs/promises";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import sanitize from "sanitize-filename";
|
import sanitize from "sanitize-filename";
|
||||||
import { CustomExecution, env, EventEmitter, ExtensionContext, Pseudoterminal, ShellExecution, TaskDefinition, TaskGroup, TaskPanelKind, TaskRevealKind, tasks, TaskScope, TerminalDimensions, Uri, window, workspace, WorkspaceFolder } from "vscode";
|
import { commands, CustomExecution, env, EventEmitter, ExtensionContext, Pseudoterminal, ShellExecution, TaskDefinition, TaskGroup, TaskPanelKind, TaskRevealKind, tasks, TaskScope, TerminalDimensions, Uri, window, workspace, WorkspaceFolder } from "vscode";
|
||||||
import { ComponentsManager } from "./componentsManager";
|
import { ComponentsManager } from "./componentsManager";
|
||||||
import { ConfigurationManager, Platform, Section } from "./configurationManager";
|
import { ConfigurationManager, Platform, Section } from "./configurationManager";
|
||||||
import { componentsTreeDataProvider, historyTreeDataProvider } from './extension';
|
import { componentsTreeDataProvider, historyTreeDataProvider } from './extension';
|
||||||
@@ -70,8 +70,8 @@ export interface CommandArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Act {
|
export class Act {
|
||||||
static command: string = 'act';
|
static defaultActCommand: string = 'act';
|
||||||
static githubCliCommand: string = 'gh act';
|
static githubCliActCommand: string = 'gh act';
|
||||||
context: ExtensionContext;
|
context: ExtensionContext;
|
||||||
storageManager: StorageManager;
|
storageManager: StorageManager;
|
||||||
secretManager: SecretManager;
|
secretManager: SecretManager;
|
||||||
@@ -175,20 +175,29 @@ export class Act {
|
|||||||
tasks.onDidEndTaskProcess(async e => {
|
tasks.onDidEndTaskProcess(async e => {
|
||||||
const taskDefinition = e.execution.task.definition;
|
const taskDefinition = e.execution.task.definition;
|
||||||
if (taskDefinition.type === 'nektos/act installation' && e.exitCode === 0) {
|
if (taskDefinition.type === 'nektos/act installation' && e.exitCode === 0) {
|
||||||
// Update base act command based on installation method
|
this.updateActCommand(taskDefinition.ghCliInstall ? Act.githubCliActCommand : Act.defaultActCommand);
|
||||||
if (taskDefinition.ghCliInstall) {
|
|
||||||
await ConfigurationManager.set(Section.actCommand, Act.githubCliCommand);
|
|
||||||
} else {
|
|
||||||
await ConfigurationManager.set(Section.actCommand, Act.command);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentsTreeDataProvider.refresh();
|
componentsTreeDataProvider.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getActCommand() {
|
static getActCommand() {
|
||||||
return ConfigurationManager.get<string>(Section.actCommand) || Act.command;
|
return ConfigurationManager.get<string>(Section.actCommand) || Act.defaultActCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateActCommand(newActCommand: string) {
|
||||||
|
const actCommand = ConfigurationManager.get(Section.actCommand);
|
||||||
|
|
||||||
|
if (newActCommand !== actCommand) {
|
||||||
|
window.showInformationMessage(`The act command is currently set to "${actCommand}". Once the installation is complete, it is recommended to update this to "${newActCommand}" for this selected installation method.`, 'Proceed', 'Manually Edit').then(async value => {
|
||||||
|
if (value === 'Proceed') {
|
||||||
|
await ConfigurationManager.set(Section.actCommand, newActCommand);
|
||||||
|
componentsTreeDataProvider.refresh();
|
||||||
|
} else if (value === 'Manually Edit') {
|
||||||
|
await commands.executeCommand('workbench.action.openSettings', ConfigurationManager.getSearchTerm(Section.actCommand));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async runAllWorkflows(workspaceFolder: WorkspaceFolder) {
|
async runAllWorkflows(workspaceFolder: WorkspaceFolder) {
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ export class ComponentsManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
act.updateActCommand(Act.defaultActCommand);
|
||||||
} else if (selectedInstallationMethod.link) {
|
} else if (selectedInstallationMethod.link) {
|
||||||
await env.openExternal(Uri.parse(selectedInstallationMethod.link));
|
await env.openExternal(Uri.parse(selectedInstallationMethod.link));
|
||||||
window.showInformationMessage('Once nektos/act is successfully installed, add it to your shell\'s PATH and then refresh the components view.', 'Refresh').then(async value => {
|
window.showInformationMessage('Once nektos/act is successfully installed, add it to your shell\'s PATH and then refresh the components view.', 'Refresh').then(async value => {
|
||||||
@@ -122,6 +124,8 @@ export class ComponentsManager {
|
|||||||
componentsTreeDataProvider.refresh();
|
componentsTreeDataProvider.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
act.updateActCommand(Act.defaultActCommand);
|
||||||
} else {
|
} else {
|
||||||
await act.install(selectedInstallationMethod.label);
|
await act.install(selectedInstallationMethod.label);
|
||||||
}
|
}
|
||||||
@@ -232,7 +236,7 @@ export class ComponentsManager {
|
|||||||
problemMatchers: [],
|
problemMatchers: [],
|
||||||
runOptions: {},
|
runOptions: {},
|
||||||
group: TaskGroup.Build,
|
group: TaskGroup.Build,
|
||||||
execution: new ShellExecution('sudo groupadd docker; sudo usermod -aG docker $USER; newgrp docker')
|
execution: new ShellExecution('sudo groupadd docker; sudo usermod -aG docker $USER')
|
||||||
});
|
});
|
||||||
|
|
||||||
window.withProgress({ location: { viewId: ComponentsTreeDataProvider.VIEW_ID } }, async () => {
|
window.withProgress({ location: { viewId: ComponentsTreeDataProvider.VIEW_ID } }, async () => {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export namespace ConfigurationManager {
|
|||||||
|
|
||||||
let actCommand = ConfigurationManager.get<string>(Section.actCommand);
|
let actCommand = ConfigurationManager.get<string>(Section.actCommand);
|
||||||
if (!actCommand) {
|
if (!actCommand) {
|
||||||
await ConfigurationManager.set(Section.actCommand, Act.command);
|
await ConfigurationManager.set(Section.actCommand, Act.defaultActCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user