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
4 changes: 2 additions & 2 deletions actions/setup/js/runtime_import.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ async function processUrlImport(url, optional, startLine, endLine) {

// Check for front matter and warn
if (hasFrontMatter(content)) {
core.warning(`URL ${url} contains front matter which will be ignored in runtime import`);
core.debug(`URL ${url} contains front matter which will be ignored in runtime import`);
// Remove front matter (everything between first --- and second ---)
const lines = content.split("\n");
let inFrontMatter = false;
Expand Down Expand Up @@ -814,7 +814,7 @@ async function processRuntimeImport(filepathOrUrl, optional, workspaceDir, start

// Check for front matter and warn
if (hasFrontMatter(content)) {
core.warning(`File ${filepath} contains front matter which will be ignored in runtime import`);
core.debug(`File ${filepath} contains front matter which will be ignored in runtime import`);
// Remove front matter (everything between first --- and second ---)
const lines = content.split("\n");
let inFrontMatter = false;
Expand Down
6 changes: 3 additions & 3 deletions actions/setup/js/runtime_import.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import fs from "fs";
import path from "path";
import os from "os";
const core = { info: vi.fn(), warning: vi.fn(), setFailed: vi.fn() };
const core = { info: vi.fn(), warning: vi.fn(), debug: vi.fn(), setFailed: vi.fn() };
global.core = core;
const { processRuntimeImports, processRuntimeImport, hasFrontMatter, removeXMLComments, hasGitHubActionsMacros, isSafeExpression, evaluateExpression } = require("./runtime_import.cjs");
describe("runtime_import", () => {
Expand Down Expand Up @@ -365,14 +365,14 @@ describe("runtime_import", () => {
const result = await processRuntimeImport("missing.md", !0, tempDir);
(expect(result).toBe(""), expect(core.warning).toHaveBeenCalledWith("Optional runtime import file not found: workflows/missing.md"));
}),
it("should remove front matter and warn", async () => {
it("should remove front matter and log debug message", async () => {
const filepath = "with-frontmatter.md";
fs.writeFileSync(path.join(workflowsDir, filepath), "---\ntitle: Test\nkey: value\n---\n\n# Content\n\nActual content.");
const result = await processRuntimeImport(filepath, !1, tempDir);
(expect(result).toContain("# Content"),
expect(result).toContain("Actual content."),
expect(result).not.toContain("title: Test"),
expect(core.warning).toHaveBeenCalledWith(`File workflows/${filepath} contains front matter which will be ignored in runtime import`));
expect(core.debug).toHaveBeenCalledWith(`File workflows/${filepath} contains front matter which will be ignored in runtime import`));
}),
it("should remove XML comments", async () => {
fs.writeFileSync(path.join(workflowsDir, "with-comments.md"), "# Title\n\n\x3c!-- This is a comment --\x3e\n\nContent here.");
Expand Down