Skip to content

Add .md/.yml/.yaml/.toml file preview support and remove gateway.log inlining#13728

Merged
pelikhan merged 2 commits intomainfrom
copilot/update-file-preview-rendering
Feb 4, 2026
Merged

Add .md/.yml/.yaml/.toml file preview support and remove gateway.log inlining#13728
pelikhan merged 2 commits intomainfrom
copilot/update-file-preview-rendering

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

The file display helper only rendered .json, .jsonl, .log, and .txt files. Markdown and configuration files were skipped. Additionally, parse_mcp_gateway_log.cjs contained outdated code that inlined gateway.log content when gateway.md was present.

Changes

  • display_file_helpers.cjs: Added .md, .yml, .yaml, .toml to displayExtensions array
  • parse_mcp_gateway_log.cjs: Removed 15 lines that read and output gateway.log when gateway.md exists
  • Tests: Updated to verify new file types render and removed test for deleted behavior

Before:

const displayExtensions = [".json", ".jsonl", ".log", ".txt"];

After:

const displayExtensions = [".json", ".jsonl", ".log", ".txt", ".md", ".yml", ".yaml", ".toml"];
Original prompt

Reference: https://github.com/github/gh-aw/actions/runs/21672687909/job/62484453714#step:36:1

The JavaScript that generate a preview of files should also render .md , .yml .yaml, .toml files

See report

Remove code that tries to inline gateway.log, it is outdated.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ay.log inlining

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update file preview rendering for additional file types Add .md/.yml/.yaml/.toml file preview support and remove gateway.log inlining Feb 4, 2026
Copilot AI requested a review from pelikhan February 4, 2026 13:34
@pelikhan pelikhan marked this pull request as ready for review February 4, 2026 13:37
Copilot AI review requested due to automatic review settings February 4, 2026 13:37
@pelikhan pelikhan merged commit 44d2ec0 into main Feb 4, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/update-file-preview-rendering branch February 4, 2026 13:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the GitHub Actions file preview helper to render additional human-readable file types (Markdown and common config formats) and removes outdated behavior that inlined gateway.log when gateway.md is present.

Changes:

  • Added .md, .yml, .yaml, and .toml to the set of file extensions whose contents are printed in log groups.
  • Removed the gateway.log inlining path when gateway.md exists, writing gateway.md directly to the step summary.
  • Updated tests to cover the newly supported file types and to validate removal of the legacy gateway.log inlining behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
actions/setup/js/display_file_helpers.cjs Expands supported preview extensions to include Markdown/YAML/TOML.
actions/setup/js/display_file_helpers.test.cjs Adds/adjusts unit tests to verify content rendering for the new file types and unsupported-extension behavior.
actions/setup/js/parse_mcp_gateway_log.cjs Removes outdated logic that read/printed gateway.log when gateway.md is available.
actions/setup/js/parse_mcp_gateway_log.test.cjs Updates tests to reflect the new gateway.md-only behavior and .md preview support.
Comments suppressed due to low confidence (1)

actions/setup/js/parse_mcp_gateway_log.test.cjs:315

  • Restoring the original fs functions and deleting global.core happens inside the try block. If an assertion throws, these globals/mocks may leak into subsequent tests. Move the restore/cleanup into the finally block (or use vi.spyOn + vi.restoreAllMocks) so it always runs.
        // Restore original functions
        fs.existsSync = originalExistsSync;
        fs.readFileSync = originalReadFileSync;
        delete global.core;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


fs.readFileSync = vi.fn((filepath, encoding) => {
if (filepath === "/tmp/gh-aw/mcp-logs/gateway.md") {
return fs.readFileSync(gatewayMdPath, encoding);
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fs.readFileSync mock calls fs.readFileSync(gatewayMdPath, ...) inside its own mock implementation, which will recurse indefinitely because fs.readFileSync has already been replaced. Use the saved originalReadFileSync (or another unmocked reference) to read the temp file content.

Suggested change
return fs.readFileSync(gatewayMdPath, encoding);
return originalReadFileSync(gatewayMdPath, encoding);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments