Replace github-script with file-based approach to avoid large JSON output max limit#177
Replace github-script with file-based approach to avoid large JSON output max limit#177lindseywild wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the root composite GitHub Action to avoid Linux ARG_MAX failures when handling large JSON payloads by moving results processing to a file-based flow, while preserving the existing results output and adding a new file-path output for large datasets.
Changes:
- Replaces the
actions/github-script@v8“Set results output” step with bash + inline Node that reads/writes JSON via files. - Adds a new
results_fileoutput pointing to the generatedscanner-results.json. - Switches caching of results from value-based
gh-cache/cacheto file-basedgh-cache/saveby copyingscanner-results.jsonto the cache path first.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bb1f458 to
1b3db1c
Compare
The 'Set results output' step used actions/github-script@v8, which interpolated large filings JSON (~138KB+) as a CLI argument to node. This exceeded Linux's ARG_MAX limit, causing 'Argument list too long' errors. Changes: - Replace github-script step with bash heredoc + node heredoc approach that writes data to temp files, avoiding CLI arg limits - Add results_file output for consumers needing large dataset support - Switch cache saving from value-based to file-based using gh-cache/save - Keep results output for backward compatibility Resolves github/accessibility#10354 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1b3db1c to
b55df88
Compare
The 'Output cached value' step cats a JSON file into GITHUB_OUTPUT followed by an EOF delimiter, but if the file has no trailing newline the delimiter lands on the same line as the content, causing: 'Invalid value. Matching delimiter not found EOF' Add a bare echo to ensure a newline before the closing delimiter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
abdulahmad307
left a comment
There was a problem hiding this comment.
the code looks good. I think we need to go through the run logs and make sure issues were opened (or re-opened) correctly before merging
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| # Set results_file output | ||
| echo "results_file=$RESULTS_FILE" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
does this always execute, even if results_file doesn't get configured in the YAML file?
There was a problem hiding this comment.
Yes, it always executes; the results_file output is just set unconditionally on the action, and consumers only use it if they reference steps.<id>.outputs.results_file. If they don't reference it, it's ignored.
Summary
Replaces the
actions/github-script@v8"Set results output" step with a file-based bash/node approach to avoid Linux'sARG_MAXlimit when processing large JSON payloads (~138KB+).Problem
The previous implementation interpolated large
filingsJSON directly as a CLI argument tonodeviagithub-script. This exceeded theARG_MAXlimit on Linux runners, causing:Changes
Replaced
github-script@v8step with two bash steps:scanner-results.jsonAdded
results_fileoutput — a new composite action output pointing to the JSON file, for consumers that need to handle large datasets without output size limits.Switched cache saving from the value-based
gh-cache/cacheaction to the file-basedgh-cache/saveaction, copyingscanner-results.jsonto the cache key path first.Backward compatibility
resultsoutput is still set viaGITHUB_OUTPUTheredoc delimiter for existing consumers.results_fileoutput is additive and opt-in.[Staff only] Resolves github/accessibility#10354