Add getActCommand

Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
Sanjula Ganepola
2024-11-25 00:10:45 -05:00
parent b0e07549a6
commit b6a12f35a8
3 changed files with 11 additions and 6 deletions

View File

@@ -68,7 +68,7 @@ export interface CommandArgs {
export class Act {
static command: string = 'act';
static githubCliCommand: string = 'act';
static githubCliCommand: string = 'gh act';
context: ExtensionContext;
storageManager: StorageManager;
secretManager: SecretManager;
@@ -216,6 +216,10 @@ export class Act {
});
}
static getActCommand() {
return ConfigurationManager.get<string>(Section.actCommand) || Act.command;
}
async runAllWorkflows(workspaceFolder: WorkspaceFolder) {
return await this.runCommand({
path: workspaceFolder.uri.fsPath,
@@ -307,7 +311,7 @@ export class Act {
} catch (error: any) { }
// Build command with settings
const actCommand = ConfigurationManager.get<string>(Section.actCommand) || Act.command;
const actCommand = Act.getActCommand();
const settings = await this.settingsManager.getSettings(workspaceFolder, true);
const command =
`set -o pipefail; ` +
@@ -391,9 +395,9 @@ export class Act {
});
if (command.includes('gh-act')) {
ConfigurationManager.set(Section.actCommand, Act.command);
} else {
ConfigurationManager.set(Section.actCommand, Act.githubCliCommand);
} else {
ConfigurationManager.set(Section.actCommand, Act.command);
}
}
}

View File

@@ -1,5 +1,6 @@
import * as childProcess from "child_process";
import { commands, env, extensions, QuickPickItemKind, ShellExecution, TaskGroup, TaskPanelKind, TaskRevealKind, tasks, TaskScope, ThemeIcon, Uri, window } from "vscode";
import { Act } from "./act";
import { ConfigurationManager, Platform, Section } from "./configurationManager";
import { act, componentsTreeDataProvider } from "./extension";
import ComponentsTreeDataProvider from "./views/components/componentsTreeDataProvider";
@@ -33,7 +34,7 @@ export class ComponentsManager {
async getComponents(): Promise<Component<CliStatus | ExtensionStatus>[]> {
const components: Component<CliStatus | ExtensionStatus>[] = [];
const actCliInfo = await this.getCliInfo('act --version', /act version (.+)/, false, false);
const actCliInfo = await this.getCliInfo(`${Act.getActCommand()} --version`, /act version (.+)/, false, false);
components.push({
name: 'nektos/act',
icon: 'terminal',