Add .md/.yml/.yaml/.toml file preview support and remove gateway.log inlining#13728
Add .md/.yml/.yaml/.toml file preview support and remove gateway.log inlining#13728
Conversation
…ay.log inlining Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
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.tomlto the set of file extensions whose contents are printed in log groups. - Removed the
gateway.loginlining path whengateway.mdexists, writinggateway.mddirectly to the step summary. - Updated tests to cover the newly supported file types and to validate removal of the legacy
gateway.loginlining 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.corehappens inside thetryblock. If an assertion throws, these globals/mocks may leak into subsequent tests. Move the restore/cleanup into thefinallyblock (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); |
There was a problem hiding this comment.
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.
| return fs.readFileSync(gatewayMdPath, encoding); | |
| return originalReadFileSync(gatewayMdPath, encoding); |
The file display helper only rendered
.json,.jsonl,.log, and.txtfiles. Markdown and configuration files were skipped. Additionally,parse_mcp_gateway_log.cjscontained outdated code that inlinedgateway.logcontent whengateway.mdwas present.Changes
display_file_helpers.cjs: Added.md,.yml,.yaml,.tomltodisplayExtensionsarrayparse_mcp_gateway_log.cjs: Removed 15 lines that read and outputgateway.logwhengateway.mdexistsBefore:
After:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.