feat: add write_output_files_only to keep file lists out of GITHUB_OUTPUT - #2937
Open
diogokiss wants to merge 1 commit into
Open
feat: add write_output_files_only to keep file lists out of GITHUB_OUTPUT#2937diogokiss wants to merge 1 commit into
diogokiss wants to merge 1 commit into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 71 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
diogokiss
force-pushed
the
feat/write-output-files-only
branch
from
August 18, 2026 12:17
9f9852f to
fbd0bd3
Compare
…TPUT
Setting `write_output_files: true` writes the changed file lists to files in
`output_dir`, but it does not stop them also being set as step outputs. There
is no way to ask for the files alone, so a workflow that only ever reads the
files still pays for the outputs.
That cost is not always small. Every filter key produces fourteen file lists,
and on a large diff each one holds the whole set of paths. The runner reads
the output file in one piece and applies no size limit to it, so a big enough
diff can exhaust it while it processes the file, taking the job down with it.
This adds `write_output_files_only`. When enabled, the fourteen file lists are
written to `output_dir` and left out of the output file. Counts, the `any_*`
and `only_*` flags, and the `changed_keys` and `modified_keys` lists are still
set as outputs, so steps that gate on them keep working unchanged.
Enabling it implies `write_output_files`, so it works on its own and does not
have to be paired with another input. Setting both is deliberately not an
error: an action cannot tell an input explicitly set to `false` from one left
at its declared default, so a real contradiction is not detectable, and
refusing the harmless redundant case would only get in the way.
Measured on a generated repository with one filter matching every changed
file, at 40,000 changed files:
default 6,300,409 bytes, 37 keys, 14 of 14 lists
write_output_files_only 3,040 bytes, 23 keys, 0 of 14 lists
Both runs write the same 37 files to `output_dir`, and the changed file list
read back from disk holds all 40,000 paths either way. The twenty-one counting
and gating outputs are present in both.
Nothing changes for anyone who does not enable it.
The README input table is generated from `action.yml` by auto-doc, so it is
left untouched here.
References:
tj-actions#2933
https://github.com/tj-actions/changed-files/blob/934b2d2c7e653bb8c968afed5a0428617f09aa24/src/utils.ts#L1504
https://github.com/actions/runner/blob/main/src/Runner.Worker/FileCommandManager.cs
diogokiss
force-pushed
the
feat/write-output-files-only
branch
from
August 18, 2026 12:33
fbd0bd3 to
352fd2a
Compare
diogokiss
marked this pull request as ready for review
August 18, 2026 12:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This Pull Request was opened by an AI agent, which has been previously reviewed and green-lit by a human, @diogokiss.
Addresses cause 3 of #2933.
The name and shape here are a suggestion, not a request. I have picked something that seemed
reasonable and made it work end to end, so there is something concrete to react to rather than a
proposal to discuss in the abstract. Happy to rename it, narrow it, widen it, or take a completely
different approach — say which and I will redo it.
The problem
write_output_files: truewrites the changed file lists tooutput_dir, but it does not stop themalso being set as step outputs
(
src/utils.ts#L1504runs unconditionally, before the file-writing branch). A workflow that only ever reads the files still
pays for the outputs, and no input turns that off.
That cost is not always small. Every filter key produces fourteen file lists, and on a large diff each
holds the whole set of paths. The runner reads the output file in one piece with
File.ReadAllTextandapplies no size limit to it, unlike step summaries which are capped at 1 MB. A big enough diff can
exhaust the runner while it processes the file and take the job down.
The change
write_output_files_only. When enabled, the fourteen file lists go tooutput_dirand are left out of$GITHUB_OUTPUT. Everything small stays an output, so existing gating keeps working:write_output_files_only*_fileslistsoutput_dironly*_countany_*,only_*changed_keys,modified_keysEnabling it implies
write_output_files, so it works on its own:Setting both is deliberately not an error. An action cannot tell an input explicitly set to
falsefrom one left at its declared default, so a real contradiction is not detectable, and refusing the
harmless redundant case would only get in the way of anyone adding this to a step that already sets
write_output_files: true.Measured
Generated repository, one filter key matching every changed file, 40,000 changed files, same build,
only the input differs:
$GITHUB_OUTPUTwrite_output_files_only: trueBoth runs write the same 37 files to
output_dir, andcontent_all_changed_files.jsonholds all40,000 paths either way. The twenty-one counting and gating outputs are present in both, as are
changed_keysandmodified_keys.Notes on the implementation
setOutputgained askipGithubOutputflag, and the fourteenpath-list call sites pass it. I did not key off
setArrayOutput, because only three of the fourteenlists go through it and it also carries
changed_keysandmodified_keys, which must not besuppressed.
setOutputwith and without the flag, and that the input implieswrite_output_files.yarn allpasses: build, prettier, eslint with--max-warnings 0, ncc package, jest with coverage(68 tests, 4 suites).
dist/is rebuilt in the same commit.action.ymlby auto-doc, so it is left untouched here.Relationship to the other Pull Requests
Independent of both. #2934 makes processing a diff cheaper, this stops the result being copied where it
is not wanted, and #2936 is about which two commits get compared in the first place. They apply to the
same failure but none of them needs the others.