Fix the packaged prompt path (#15)
Resolve the packaged prompt from the repository root after TypeScript moved into `src/`. Adds a regression test that verifies every module-relative runtime asset exists. Root suite: 38 passed. Reviewed-on: #15 Co-authored-by: Danny Kim <temeddix@gmail.com> Co-committed-by: Danny Kim <temeddix@gmail.com>
This commit was merged in pull request #15.
This commit is contained in:
+1
-1
@@ -152,7 +152,7 @@ async function renderPrompt(
|
||||
ANCHORS_PATH: anchorsPath,
|
||||
};
|
||||
const template = await Deno.readTextFile(
|
||||
new URL("prompt.md", import.meta.url),
|
||||
new URL("../prompt.md", import.meta.url),
|
||||
);
|
||||
return {
|
||||
prompt: template.replace(
|
||||
|
||||
@@ -106,6 +106,18 @@ Deno.test("the source protection script stages immutable action files", async ()
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test("module-relative runtime assets exist", async () => {
|
||||
const module = new URL("run.ts", import.meta.url);
|
||||
const source = await Deno.readTextFile(module);
|
||||
for (
|
||||
const match of source.matchAll(/new URL\("([^"]+)", import\.meta\.url\)/g)
|
||||
) {
|
||||
const asset = new URL(match[1], module);
|
||||
const stat = await Deno.stat(asset);
|
||||
assert(stat.isFile, asset.pathname);
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test("the repository uses its trusted main action", async () => {
|
||||
const workflow = await yaml(".gitea/workflows/agents.yml");
|
||||
const job = mapping(mapping(workflow.jobs, "jobs").agent, "jobs.agent");
|
||||
|
||||
Reference in New Issue
Block a user