fix(action): write changelog to file to avoid E2BIG on large repos#753
Merged
fix(action): write changelog to file to avoid E2BIG on large repos#753
Conversation
37417d2 to
c0973ad
Compare
Repos with large changelogs (e.g. sentry's monthly releases with hundreds of PRs) can exceed the ~2 MB Linux ARG_MAX limit when the changelog is passed as an environment variable in composite action steps, causing "Argument list too long" errors. Changes: - Add writeGitHubActionsFile() and truncateForOutput() helpers - Write the full changelog to $RUNNER_TEMP/craft/changelog.md - Truncate the changelog step output to ~64 KB for safety - Update action.yml to read changelog from file instead of env var - Expose changelog_file output in action.yml and release.yml
c0973ad to
ea8a424
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
- Truncate CHANGELOG to 60K chars in action.yml before embedding in issue body to stay under GitHub's ~65K issue body limit - Remove changelog_file from workflow_call outputs since RUNNER_TEMP paths are not accessible across jobs - Only strip last character in truncateForOutput when it is the Unicode replacement character (split mid-codepoint), not unconditionally - Subtract notice length from truncation budget so total output stays within MAX_STEP_OUTPUT_BYTES - Detect setext-style section boundaries (line + --- or ===) in getChangelogLineRange for accurate end-of-section detection
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.
Summary
Fixes the
Argument list too long(E2BIG) error in thegetsentry/sentryrelease workflow (failed run).Root cause
Sentry's monthly releases produce changelogs with hundreds of PRs.
craft preparewrites the full changelog as a GitHub Actions step output. Theaction.yml"Request publish" step then expands${{ steps.craft.outputs.changelog }}into aCHANGELOGenvironment variable. The combined environment exceeds the ~2 MB LinuxARG_MAXlimit, causingexecve('/usr/bin/bash')to fail withE2BIG.Changes
Binary (
craft prepare):$RUNNER_TEMP/craft/changelog.mdand expose its path as thechangelog_filestep outputchangelogstep output to 64 KB (including the truncation notice) so olderaction.ymlversions that read it via env var don't hit E2BIG#L3-L538) so the truncation notice links to the full content\uFFFD), not unconditionally---/===) ingetChangelogLineRangefor accurate line range calculationaction.yml(composite action):changelog_filepath instead of expanding the full text into aCHANGELOGenv var — eliminates the E2BIG errorchangelog_fileas an action output for same-job consumers.github/workflows/release.yml:changelog_filefromworkflow_calloutputs since$RUNNER_TEMPpaths are not accessible across jobs (different runners)Backward compatibility
changelogstep output is still set (truncated) for consumers that read it directlycraft >= 2.22.0; for older craft versions theaction.ymlgracefully falls back to creating the issue without a changelog section