Skip to content

Commit db62980

Browse files
authored
fix: Avoid "Argument list too long" when setting results output (#79)
This PR updates the “Set results output” step so data from previous steps is directly interpolated into the JS script, rather than passed via environment variables. This prevents “Argument list too long” errors (and resulting workflow failures). Under the hood, `actions/github-script` was doing something like this: ```shell FILINGS='/** A huge JSON blob **/' FIXINGS='/** A huge JSON blob **/' node tmp/script.js ``` Depending on the size of `FILINGS` and `FIXINGS`, this could exceed a system’s `ARG_MAX` (https://www.in-ulm.de/~mascheck/various/argmax/ is a good explainer). After removing the environment variables, the argument list length is much shorter, so the error is avoided.
2 parents a473a51 + 565212b commit db62980

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

action.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ runs:
109109
uses: actions/github-script@v8
110110
with:
111111
script: |
112-
const filings = JSON.parse(process.env.FILINGS || '[]');
113-
const fixings = JSON.parse(process.env.FIXINGS || '[]');
112+
const filings = ${{ steps.file.outputs.filings || '""' }} || [];
113+
const fixings = ${{ steps.fix.outputs.fixings || '""' }} || [];
114114
const fixingsByIssueUrl = fixings.reduce((acc, fixing) => {
115115
if (fixing.issue && fixing.issue.url) {
116116
acc[fixing.issue.url] = fixing;
@@ -125,9 +125,6 @@ runs:
125125
}
126126
core.setOutput('results', JSON.stringify(results));
127127
core.debug(`Results: ${JSON.stringify(results)}`);
128-
env:
129-
FILINGS: ${{ steps.file.outputs.filings }}
130-
FIXINGS: ${{ steps.fix.outputs.fixings }}
131128
- name: Save cached results
132129
uses: ./../../_actions/github/accessibility-scanner/current/.github/actions/gh-cache/cache
133130
with:

0 commit comments

Comments
 (0)