diff --git a/.github/workflows/repository-quality-improver.lock.yml b/.github/workflows/repository-quality-improver.lock.yml index 6fd6b4cb7bc..41f0b5136dd 100644 --- a/.github/workflows/repository-quality-improver.lock.yml +++ b/.github/workflows/repository-quality-improver.lock.yml @@ -29,7 +29,6 @@ name: "Repository Quality Improvement Agent" "on": schedule: - cron: "0 13 * * 1-5" - # Friendly format: daily (scattered) workflow_dispatch: permissions: diff --git a/actions/setup/js/check_workflow_recompile_needed.cjs b/actions/setup/js/check_workflow_recompile_needed.cjs index a0e9fc5c955..d605527b887 100644 --- a/actions/setup/js/check_workflow_recompile_needed.cjs +++ b/actions/setup/js/check_workflow_recompile_needed.cjs @@ -127,7 +127,9 @@ async function main() { const runUrl = context.payload.repository ? `${context.payload.repository.html_url}/actions/runs/${context.runId}` : `${githubServer}/${owner}/${repo}/actions/runs/${context.runId}`; // Read the issue template from the prompts directory - const templatePath = "/opt/gh-aw/prompts/workflow_recompile_issue.md"; + // Allow override via environment variable for testing + const promptsDir = process.env.GH_AW_PROMPTS_DIR || "/opt/gh-aw/prompts"; + const templatePath = `${promptsDir}/workflow_recompile_issue.md`; let issueTemplate; try { issueTemplate = fs.readFileSync(templatePath, "utf8"); diff --git a/actions/setup/js/check_workflow_recompile_needed.test.cjs b/actions/setup/js/check_workflow_recompile_needed.test.cjs index 458010aa27b..b25ff786f7b 100644 --- a/actions/setup/js/check_workflow_recompile_needed.test.cjs +++ b/actions/setup/js/check_workflow_recompile_needed.test.cjs @@ -2,6 +2,7 @@ import { describe, it, expect, beforeEach, afterEach, vi } from "vitest"; import fs from "fs"; import path from "path"; +import os from "os"; describe("check_workflow_recompile_needed", () => { let mockCore; @@ -9,9 +10,17 @@ describe("check_workflow_recompile_needed", () => { let mockContext; let mockExec; let originalGlobals; - const templatePath = "/opt/gh-aw/prompts/workflow_recompile_issue.md"; + let originalEnv; + const testPromptsDir = path.join(os.tmpdir(), "gh-aw-test", "prompts"); + const templatePath = path.join(testPromptsDir, "workflow_recompile_issue.md"); beforeEach(() => { + // Save original environment + originalEnv = process.env.GH_AW_PROMPTS_DIR; + + // Set test prompts directory + process.env.GH_AW_PROMPTS_DIR = testPromptsDir; + // Create the template file for testing const templateDir = path.dirname(templatePath); if (!fs.existsSync(templateDir)) { @@ -140,9 +149,17 @@ The following workflow lock files have changes: }); afterEach(() => { - // Clean up the template file - if (fs.existsSync(templatePath)) { - fs.unlinkSync(templatePath); + // Restore environment variable + if (originalEnv !== undefined) { + process.env.GH_AW_PROMPTS_DIR = originalEnv; + } else { + delete process.env.GH_AW_PROMPTS_DIR; + } + + // Clean up the test directory + const testDir = path.join(os.tmpdir(), "gh-aw-test"); + if (fs.existsSync(testDir)) { + fs.rmSync(testDir, { recursive: true, force: true }); } // Restore original globals