fix: persist OG image cache outside act runner workspace
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m51s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m51s
The cache was written to .cache/og/ relative to the workspace, which is under /usr/local/git/.cache/act/<unique-hash>/hostexecutor/ — a new path per run, so every build regenerated all images from scratch. OG_CACHE_DIR env var now controls the cache path (resolved to an absolute path). CI sets it to /usr/local/git/.cache/og, which survives between runs. Locally it still defaults to .cache/og inside the project dir. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* CLI entry point for OG image generation.
|
||||
* Runs as a separate process to isolate memory from Eleventy.
|
||||
*
|
||||
* Usage: node lib/og-cli.js <contentDir> <cacheDir> <siteName> [batchSize]
|
||||
* Usage: node lib/og-cli.js <contentDir> <ogDir> <siteName> [batchSize]
|
||||
*
|
||||
* batchSize: Max images to generate per invocation (0 = unlimited).
|
||||
* When set, exits after generating that many images so the caller
|
||||
@@ -14,15 +14,15 @@
|
||||
|
||||
import { generateOgImages } from "./og.js";
|
||||
|
||||
const [contentDir, cacheDir, siteName, batchSizeStr] = process.argv.slice(2);
|
||||
const [contentDir, ogDir, siteName, batchSizeStr] = process.argv.slice(2);
|
||||
|
||||
if (!contentDir || !cacheDir || !siteName) {
|
||||
console.error("[og] Usage: node og-cli.js <contentDir> <cacheDir> <siteName> [batchSize]");
|
||||
if (!contentDir || !ogDir || !siteName) {
|
||||
console.error("[og] Usage: node og-cli.js <contentDir> <ogDir> <siteName> [batchSize]");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const batchSize = parseInt(batchSizeStr, 10) || 0;
|
||||
const result = await generateOgImages(contentDir, cacheDir, siteName, batchSize);
|
||||
const result = await generateOgImages(contentDir, ogDir, siteName, batchSize);
|
||||
|
||||
// Exit code 2 signals "batch complete, more images remain"
|
||||
if (result?.hasMore) {
|
||||
|
||||
@@ -426,8 +426,7 @@ function scanContentFiles(contentDir) {
|
||||
* @param {number} batchSize - Max images to generate (0 = unlimited)
|
||||
* @returns {{ hasMore: boolean }} Whether more images need generation
|
||||
*/
|
||||
export async function generateOgImages(contentDir, cacheDir, siteName, batchSize = 0) {
|
||||
const ogDir = join(cacheDir, "og");
|
||||
export async function generateOgImages(contentDir, ogDir, siteName, batchSize = 0) {
|
||||
mkdirSync(ogDir, { recursive: true });
|
||||
|
||||
const manifestPath = join(ogDir, "manifest.json");
|
||||
|
||||
Reference in New Issue
Block a user