Skip to content

Avoid long GitHub errors causing excessively-long run-summaries#3844

Merged
rtyley merged 1 commit intomainfrom
avoid-long-github-errors-causing-excessively-long-run-summaries
Mar 10, 2026
Merged

Avoid long GitHub errors causing excessively-long run-summaries#3844
rtyley merged 1 commit intomainfrom
avoid-long-github-errors-causing-excessively-long-run-summaries

Conversation

@rtyley
Copy link
Copy Markdown
Contributor

@rtyley rtyley commented Mar 10, 2026

With the sadly declining reliability of the GitHub API, I've started to see Scala Steward run summaries become so large that they exceed GitHub Actions' 1024k limit:

call-reusable-workflow / scala-steward
$GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of 1024k, got 1194k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary

In that example, the run summary for just 37 repos is 1194KB because many of them failed with a 502 Bad Gateway response from GitHub - and when GitHub fails like that, it returns a large HTML error page - about 55KB of HTML:

2026-03-10 10:43:51,750 ERROR Steward guardian/ophan failed
  org.scalasteward.core.util.UnexpectedResponse: uri: https://api.github.com/installation/repositories?per_page=100
  method: GET
  status: 502 Bad Gateway
  headers:
    cache-control: no-cache
    connection: close
    content-security-policy: default-src 'none'; style-src 'unsafe-inline'; img-src data:;
    content-type: text/html; charset=utf-8
    strict-transport-security: max-age=31536000; includeSubDomains; preload
    x-content-type-options: nosniff
    x-frame-options: deny
    x-github-request-id: 9C00:23F69F:90EE0B:2713574:69AFF5E7
    x-xss-protection: 0
  body: <!DOCTYPE html>
  <!--

  Hello future GitHubber! I bet you're here to remove those nasty inline styles,
  DRY up these templates and make 'em nice and re-usable, right?

  Please, don't. https://github.com/styleguide/templates/2.0

  -->
  <html>
    <head>
      <title>Unicorn! &middot; GitHub</title>
...
image

Fix

This change truncates the body of the response written to logs and the summary. The truncation is only for the UnexpectedResponse exception, which occurs for HTTP status codes of 5xx and above, where the full response body is less likely to be useful, and not others like DecodeFailure (where the full response body might be diagnostically useful).

With the declining reliability of the GitHub API, I've started to see
Scala Steward run summaries become so large that they exceed GitHub Actions'
1024k limit:

```
call-reusable-workflow / scala-steward
$GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of 1024k, got 1194k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary
```

The run summary for just 37 repos is 1194k, because many of them failed with a
`502 Bad Gateway` response from GitHub - and when GitHub fails like that, it
returns a large HTML error page - about 55KB of HTML:

```
2026-03-10 10:43:51,750 ERROR Steward guardian/ophan failed
  org.scalasteward.core.util.UnexpectedResponse: uri: https://api.github.com/installation/repositories?per_page=100
  method: GET
  status: 502 Bad Gateway
  headers:
    cache-control: no-cache
    connection: close
    content-security-policy: default-src 'none'; style-src 'unsafe-inline'; img-src data:;
    content-type: text/html; charset=utf-8
    strict-transport-security: max-age=31536000; includeSubDomains; preload
    x-content-type-options: nosniff
    x-frame-options: deny
    x-github-request-id: 9C00:23F69F:90EE0B:2713574:69AFF5E7
    x-xss-protection: 0
  body: <!DOCTYPE html>
  <!--

  Hello future GitHubber! I bet you're here to remove those nasty inline styles,
  DRY up these templates and make 'em nice and re-usable, right?

  Please, don't. https://github.com/styleguide/templates/2.0

  -->
  <html>
    <head>
      <title>Unicorn! &middot; GitHub</title>
...
```

## Fix

This change truncates the body of the response written to logs and the summary.
The truncation is only for the `UnexpectedResponse` exception, which occurs for HTTP
status codes of 5xx and above, where the full response body is less likely to be useful,
and not others like `DecodeFailure` (where the full response body might be
diagnostically useful).

## Background

Scala Steward run summaries were introduced in June 2023 with:

* #3071
@rtyley rtyley marked this pull request as ready for review March 10, 2026 19:01
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.39%. Comparing base (fac8db3) to head (b5d3d24).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3844   +/-   ##
=======================================
  Coverage   90.39%   90.39%           
=======================================
  Files         177      177           
  Lines        5110     5110           
  Branches      459      458    -1     
=======================================
  Hits         4619     4619           
  Misses        491      491           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@mzuehlke mzuehlke left a comment

Choose a reason for hiding this comment

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

These long error messages are of no real value. Good idea to truncate them.

@rtyley rtyley merged commit cc5e380 into main Mar 10, 2026
18 checks passed
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.

2 participants