Skip to content

Commit b55df88

Browse files
lindseywildCopilot
andcommitted
Replace github-script with file-based approach to avoid ARG_MAX limit
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>
1 parent 5bd8d26 commit b55df88

1 file changed

Lines changed: 54 additions & 21 deletions

File tree

action.yml

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ outputs:
5353
results:
5454
description: 'List of issues and pull requests filed (and their associated finding(s)), as stringified JSON'
5555
value: ${{ steps.results.outputs.results }}
56+
results_file:
57+
description: 'Path to a JSON file containing the results (use for large datasets to avoid output size limits)'
58+
value: ${{ steps.results.outputs.results_file }}
5659

5760
runs:
5861
using: 'composite'
@@ -132,38 +135,68 @@ runs:
132135
issues: ${{ steps.get_issues_from_filings.outputs.issues }}
133136
repository: ${{ inputs.repository }}
134137
token: ${{ inputs.token }}
138+
- name: Write filings and fixings to temp files
139+
shell: bash
140+
run: |
141+
cat > "$RUNNER_TEMP/filings.json" << 'FILINGS_HEREDOC_DELIMITER'
142+
${{ steps.file.outputs.filings || '[]' }}
143+
FILINGS_HEREDOC_DELIMITER
144+
145+
cat > "$RUNNER_TEMP/fixings.json" << 'FIXINGS_HEREDOC_DELIMITER'
146+
${{ steps.fix.outputs.fixings || '[]' }}
147+
FIXINGS_HEREDOC_DELIMITER
148+
135149
- name: Set results output
136150
id: results
137-
uses: actions/github-script@v8
138-
with:
139-
script: |
140-
const filings = ${{ steps.file.outputs.filings || '""' }} || [];
141-
const fixings = ${{ steps.fix.outputs.fixings || '""' }} || [];
142-
const fixingsByIssueUrl = fixings.reduce((acc, fixing) => {
143-
if (fixing.issue && fixing.issue.url) {
144-
acc[fixing.issue.url] = fixing;
145-
}
146-
return acc;
147-
}, {});
148-
const results = filings;
149-
for (const result of results) {
150-
if (result.issue && result.issue.url && fixingsByIssueUrl[result.issue.url]) {
151-
result.pullRequest = fixingsByIssueUrl[result.issue.url].pullRequest;
152-
}
151+
shell: bash
152+
run: |
153+
node << 'NODE_SCRIPT'
154+
const fs = require('fs');
155+
const path = require('path');
156+
const runnerTemp = process.env.RUNNER_TEMP;
157+
const filings = JSON.parse(fs.readFileSync(path.join(runnerTemp, 'filings.json'), 'utf8')) || [];
158+
const fixings = JSON.parse(fs.readFileSync(path.join(runnerTemp, 'fixings.json'), 'utf8')) || [];
159+
const fixingsByIssueUrl = fixings.reduce((acc, fixing) => {
160+
if (fixing.issue && fixing.issue.url) acc[fixing.issue.url] = fixing;
161+
return acc;
162+
}, {});
163+
for (const result of filings) {
164+
if (result.issue && result.issue.url && fixingsByIssueUrl[result.issue.url]) {
165+
result.pullRequest = fixingsByIssueUrl[result.issue.url].pullRequest;
153166
}
154-
core.setOutput('results', JSON.stringify(results));
155-
core.debug(`Results: ${JSON.stringify(results)}`);
167+
}
168+
const resultsPath = path.join(process.env.GITHUB_WORKSPACE, 'scanner-results.json');
169+
fs.writeFileSync(resultsPath, JSON.stringify(filings));
170+
NODE_SCRIPT
171+
172+
RESULTS_FILE="$GITHUB_WORKSPACE/scanner-results.json"
173+
174+
# Set results output (backward compat)
175+
{
176+
echo 'results<<__RESULTS_OUTPUT_DELIMITER__'
177+
cat "$RESULTS_FILE"
178+
echo
179+
echo '__RESULTS_OUTPUT_DELIMITER__'
180+
} >> "$GITHUB_OUTPUT"
181+
182+
# Set results_file output
183+
echo "results_file=$RESULTS_FILE" >> "$GITHUB_OUTPUT"
156184
- if: ${{ inputs.include_screenshots == 'true' }}
157185
name: Save screenshots
158186
uses: ./../../_actions/github/accessibility-scanner/current/.github/actions/gh-cache/save
159187
with:
160188
path: .screenshots
161189
token: ${{ inputs.token }}
190+
- name: Copy results to cache path
191+
shell: bash
192+
run: |
193+
mkdir -p "$(dirname '${{ inputs.cache_key }}')"
194+
cp "$GITHUB_WORKSPACE/scanner-results.json" "${{ inputs.cache_key }}"
195+
162196
- name: Save cached results
163-
uses: ./../../_actions/github/accessibility-scanner/current/.github/actions/gh-cache/cache
197+
uses: ./../../_actions/github/accessibility-scanner/current/.github/actions/gh-cache/save
164198
with:
165-
key: ${{ inputs.cache_key }}
166-
value: ${{ steps.results.outputs.results }}
199+
path: ${{ inputs.cache_key }}
167200
token: ${{ inputs.token }}
168201

169202
branding:

0 commit comments

Comments
 (0)