Fix act not found when installed as github cli extension
Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
@@ -685,6 +685,11 @@
|
|||||||
"configuration": {
|
"configuration": {
|
||||||
"title": "GitHub Local Actions",
|
"title": "GitHub Local Actions",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"githubLocalActions.actCommand": {
|
||||||
|
"markdownDescription": "The base `nektos/act` command to be called. By default, this will be `act` (requires the binary to be on your `PATH`). If the binary is not on your `PATH`, the command can be fully qualified. If `act` is installed as a GitHub CLI extension, this command should be set to `gh act`.",
|
||||||
|
"type": "string",
|
||||||
|
"default": "act"
|
||||||
|
},
|
||||||
"githubLocalActions.dockerDesktopPath": {
|
"githubLocalActions.dockerDesktopPath": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"markdownDescription": "The path to your Docker Desktop executable (used for Windows and MacOS). To start Docker Engine from the `Components` view, this application will be launched. Refer to the default path based on OS:\n\n* **Windows**: `C:/Program Files/Docker/Docker/Docker Desktop.exe`\n\n* **MacOS**: `/Applications/Docker.app`",
|
"markdownDescription": "The path to your Docker Desktop executable (used for Windows and MacOS). To start Docker Engine from the `Components` view, this application will be launched. Refer to the default path based on OS:\n\n* **Windows**: `C:/Program Files/Docker/Docker/Docker Desktop.exe`\n\n* **MacOS**: `/Applications/Docker.app`",
|
||||||
|
|||||||
13
src/act.ts
13
src/act.ts
@@ -2,6 +2,7 @@ import * as path from "path";
|
|||||||
import sanitize from "sanitize-filename";
|
import sanitize from "sanitize-filename";
|
||||||
import { ExtensionContext, ShellExecution, TaskGroup, TaskPanelKind, TaskRevealKind, tasks, TaskScope, Uri, window, workspace, WorkspaceFolder } from "vscode";
|
import { ExtensionContext, ShellExecution, TaskGroup, TaskPanelKind, TaskRevealKind, tasks, TaskScope, Uri, window, workspace, WorkspaceFolder } from "vscode";
|
||||||
import { ComponentsManager } from "./componentsManager";
|
import { ComponentsManager } from "./componentsManager";
|
||||||
|
import { ConfigurationManager, Section } from "./configurationManager";
|
||||||
import { componentsTreeDataProvider, historyTreeDataProvider } from './extension';
|
import { componentsTreeDataProvider, historyTreeDataProvider } from './extension';
|
||||||
import { HistoryManager, HistoryStatus } from './historyManager';
|
import { HistoryManager, HistoryStatus } from './historyManager';
|
||||||
import { SecretManager } from "./secretManager";
|
import { SecretManager } from "./secretManager";
|
||||||
@@ -66,7 +67,8 @@ export interface CommandArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Act {
|
export class Act {
|
||||||
private static base: string = 'act';
|
static command: string = 'act';
|
||||||
|
static githubCliCommand: string = 'act';
|
||||||
context: ExtensionContext;
|
context: ExtensionContext;
|
||||||
storageManager: StorageManager;
|
storageManager: StorageManager;
|
||||||
secretManager: SecretManager;
|
secretManager: SecretManager;
|
||||||
@@ -305,10 +307,11 @@ export class Act {
|
|||||||
} catch (error: any) { }
|
} catch (error: any) { }
|
||||||
|
|
||||||
// Build command with settings
|
// Build command with settings
|
||||||
|
const actCommand = ConfigurationManager.get<string>(Section.actCommand) || Act.command;
|
||||||
const settings = await this.settingsManager.getSettings(workspaceFolder, true);
|
const settings = await this.settingsManager.getSettings(workspaceFolder, true);
|
||||||
const command =
|
const command =
|
||||||
`set -o pipefail; ` +
|
`set -o pipefail; ` +
|
||||||
`${Act.base} ${commandArgs.options}` +
|
`${actCommand} ${commandArgs.options}` +
|
||||||
(settings.secrets.length > 0 ? ` ${Option.Secret} ${settings.secrets.map(secret => secret.key).join(` ${Option.Secret} `)}` : ``) +
|
(settings.secrets.length > 0 ? ` ${Option.Secret} ${settings.secrets.map(secret => secret.key).join(` ${Option.Secret} `)}` : ``) +
|
||||||
(settings.secretFiles.length > 0 ? ` ${Option.SecretFile} "${settings.secretFiles[0].path}"` : ` ${Option.SecretFile} ""`) +
|
(settings.secretFiles.length > 0 ? ` ${Option.SecretFile} "${settings.secretFiles[0].path}"` : ` ${Option.SecretFile} ""`) +
|
||||||
(settings.variables.length > 0 ? ` ${Option.Variable} ${settings.variables.map(variable => (variable.value ? `${variable.key}=${variable.value}` : variable.key)).join(` ${Option.Variable} `)}` : ``) +
|
(settings.variables.length > 0 ? ` ${Option.Variable} ${settings.variables.map(variable => (variable.value ? `${variable.key}=${variable.value}` : variable.key)).join(` ${Option.Variable} `)}` : ``) +
|
||||||
@@ -386,6 +389,12 @@ export class Act {
|
|||||||
group: TaskGroup.Build,
|
group: TaskGroup.Build,
|
||||||
execution: new ShellExecution(command)
|
execution: new ShellExecution(command)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (command.includes('gh-act')) {
|
||||||
|
ConfigurationManager.set(Section.actCommand, Act.command);
|
||||||
|
} else {
|
||||||
|
ConfigurationManager.set(Section.actCommand, Act.githubCliCommand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ConfigurationTarget, workspace } from 'vscode';
|
import { ConfigurationTarget, workspace } from 'vscode';
|
||||||
|
import { Act } from './act';
|
||||||
|
|
||||||
export enum Platform {
|
export enum Platform {
|
||||||
windows = 'win32',
|
windows = 'win32',
|
||||||
@@ -7,6 +8,7 @@ export enum Platform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum Section {
|
export enum Section {
|
||||||
|
actCommand = 'actCommand',
|
||||||
dockerDesktopPath = 'dockerDesktopPath'
|
dockerDesktopPath = 'dockerDesktopPath'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +32,11 @@ export namespace ConfigurationManager {
|
|||||||
|
|
||||||
ConfigurationManager.set(Section.dockerDesktopPath, dockerDesktopPath);
|
ConfigurationManager.set(Section.dockerDesktopPath, dockerDesktopPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let actCommand = ConfigurationManager.get<string>(Section.actCommand);
|
||||||
|
if (!actCommand) {
|
||||||
|
ConfigurationManager.set(Section.actCommand, Act.command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSearchTerm(section: Section): string {
|
export function getSearchTerm(section: Section): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user