Add secrets, variables, and inputs to storage

Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
Sanjula Ganepola
2024-10-20 18:55:28 -04:00
parent 524a724279
commit 551f6baa2f
18 changed files with 226 additions and 188 deletions

View File

@@ -2,6 +2,7 @@ import { ThemeIcon, TreeItem, TreeItemCollapsibleState, WorkspaceFolder } from "
import { act } from "../../extension";
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
import VariableTreeItem from "./variable";
import { StorageKey } from "../../storageManager";
export default class VariablesTreeItem extends TreeItem implements GithubLocalActionsTreeItem {
static contextValue = 'githubLocalActions.variables';
@@ -13,8 +14,13 @@ export default class VariablesTreeItem extends TreeItem implements GithubLocalAc
}
async getChildren(): Promise<GithubLocalActionsTreeItem[]> {
const workflows = await act.workflowsManager.getWorkflows(this.workspaceFolder);
const variables = [...new Set(workflows.map(workflow => act.settingsManager.getVariables(workflow)).flat())];
return variables.map(variable => new VariableTreeItem(this.workspaceFolder, variable));
const items: GithubLocalActionsTreeItem[] = [];
const variables = await act.settingsManager.getSetting(this.workspaceFolder, /\${{\s*vars\.(.*?)(?:\s*==\s*(.*?))?\s*}}/g, StorageKey.Variables);
for (const variable of variables) {
items.push(new VariableTreeItem(this.workspaceFolder, variable));
}
return items;
}
}