Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/repository-quality-improver.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion actions/setup/js/check_workflow_recompile_needed.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
25 changes: 21 additions & 4 deletions actions/setup/js/check_workflow_recompile_needed.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@
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;
let mockGithub;
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)) {
Expand Down Expand Up @@ -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
Expand Down