fix path reference for reusable workflows and use vscodeURI instead

This commit is contained in:
Crystal Tenn
2023-04-18 17:30:53 -04:00
parent cf2fd6332f
commit 804f83828f
+5 -1
View File
@@ -4,6 +4,7 @@ import {fileIdentifier} from "@actions/workflow-parser/workflows/file-reference"
import {Octokit} from "@octokit/rest";
import path from "path";
import {TTLCache} from "./utils/cache";
import vscodeURI from "vscode-uri/lib/umd"; // work around issues with the vscode-uri package
export function getFileProvider(
client: Octokit | undefined,
@@ -31,7 +32,10 @@ export function getFileProvider(
throw new Error("Local file references are not supported with this configuration");
}
const file = await readFile(path.join(workspace, ref.path));
const workspaceURI = vscodeURI.URI.parse(workspace);
const path = vscodeURI.Utils.joinPath(workspaceURI, ref.path);
const file = await readFile(path.toString());
if (!file) {
throw new Error(`File not found: ${ref.path}`);
}