feat(prd-6): verify workflow triggers and add assignee_trigger (#13)
This commit is contained in:
1 parent
095c2c2429
commit
a129a15f61
5 files changed
+71
-19
No files matched your search
@@ -2,6 +2,15 @@ import fs from "fs/promises";
|
||||
import path from "path";
|
||||
import type { Octokits } from "../api/client";
|
||||
|
||||
// Mutable fs reference for cross-platform test compatibility.
|
||||
// On Linux, Bun gives test and source files different fs/promises objects,
|
||||
// so spyOn(fs, "mkdir") in a test file won't intercept calls here.
|
||||
// Tests override these methods directly instead.
|
||||
export const _fsForTest = {
|
||||
mkdir: fs.mkdir.bind(fs),
|
||||
writeFile: fs.writeFile.bind(fs),
|
||||
};
|
||||
|
||||
// Build regexes at call time, reading GITHUB_SERVER_URL from process.env
|
||||
// directly. The config.ts export freezes the value at module load time,
|
||||
// which can be wrong when the Forgejo CI runner injects its own
|
||||
@@ -67,7 +76,7 @@ export async function downloadCommentImages(
|
||||
const urlToPathMap = new Map<string, string>();
|
||||
const downloadsDir = "/tmp/github-images";
|
||||
|
||||
await fs.mkdir(downloadsDir, { recursive: true });
|
||||
await _fsForTest.mkdir(downloadsDir, { recursive: true });
|
||||
|
||||
const { imageRegex, htmlImgRegex } = buildImageRegexes();
|
||||
|
||||
@@ -217,7 +226,7 @@ export async function downloadCommentImages(
|
||||
const arrayBuffer = await imageResponse.arrayBuffer();
|
||||
const buffer = Buffer.from(arrayBuffer);
|
||||
|
||||
await fs.writeFile(localPath, buffer);
|
||||
await _fsForTest.writeFile(localPath, buffer);
|
||||
console.log(`✓ Saved: ${localPath}`);
|
||||
|
||||
urlToPathMap.set(originalUrl, localPath);
|
||||
|
||||
Reference in new issue
Block a user