Skip to content

fix(action): write changelog to file to avoid E2BIG on large repos#753

Merged
BYK merged 2 commits intomasterfrom
fix/action-e2big-changelog-file
Feb 17, 2026
Merged

fix(action): write changelog to file to avoid E2BIG on large repos#753
BYK merged 2 commits intomasterfrom
fix/action-e2big-changelog-file

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 17, 2026

Summary

Fixes the Argument list too long (E2BIG) error in the getsentry/sentry release workflow (failed run).

Root cause

Sentry's monthly releases produce changelogs with hundreds of PRs. craft prepare writes the full changelog as a GitHub Actions step output. The action.yml "Request publish" step then expands ${{ steps.craft.outputs.changelog }} into a CHANGELOG environment variable. The combined environment exceeds the ~2 MB Linux ARG_MAX limit, causing execve('/usr/bin/bash') to fail with E2BIG.

Changes

Binary (craft prepare):

  • Write the full changelog to a file under $RUNNER_TEMP/craft/changelog.md and expose its path as the changelog_file step output
  • Truncate the changelog step output to 64 KB (including the truncation notice) so older action.yml versions that read it via env var don't hit E2BIG
  • Build a GitHub permalink to the changelog entry on the release branch with line range (e.g. #L3-L538) so the truncation notice links to the full content
  • Handle UTF-8 boundary correctly: only strip the last character when byte-slicing splits a multi-byte codepoint (replacement char \uFFFD), not unconditionally
  • Detect setext-style section boundaries (---/===) in getChangelogLineRange for accurate line range calculation

action.yml (composite action):

  • Read changelog from the changelog_file path instead of expanding the full text into a CHANGELOG env var — eliminates the E2BIG error
  • Truncate the changelog to 60K characters before embedding in the issue body to stay under GitHub's ~65K issue body character limit
  • Export changelog_file as an action output for same-job consumers

.github/workflows/release.yml:

  • Remove changelog_file from workflow_call outputs since $RUNNER_TEMP paths are not accessible across jobs (different runners)

Backward compatibility

  • The changelog step output is still set (truncated) for consumers that read it directly
  • Repos with small changelogs see no behavioral change — truncation only activates above 64 KB
  • The file-based approach requires craft >= 2.22.0; for older craft versions the action.yml gracefully falls back to creating the issue without a changelog section

@BYK BYK marked this pull request as draft February 17, 2026 00:39
@BYK BYK marked this pull request as ready for review February 17, 2026 00:40
@BYK BYK force-pushed the fix/action-e2big-changelog-file branch from 37417d2 to c0973ad Compare February 17, 2026 00:46
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
@BYK BYK force-pushed the fix/action-e2big-changelog-file branch from c0973ad to ea8a424 Compare February 17, 2026 00:50
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@BYK BYK merged commit 8f492eb into master Feb 17, 2026
18 checks passed
@BYK BYK deleted the fix/action-e2big-changelog-file branch February 17, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant