Skip to content

Commit

Permalink
Truncate long text fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mrginglymus committed Jan 10, 2021
1 parent c53b65d commit d78ad8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<useBeta>true</useBeta>

<!-- Jenkins Plug-in Dependencies Versions -->
<checks-api.version>1.2.0</checks-api.version>
<checks-api.version>1.3.0-rc182.e92aa81c9bc8</checks-api.version>
<plugin-util-api.version>1.6.1</plugin-util-api.version>
<github-branch-source.version>2.9.3</github-branch-source.version>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
class GitHubChecksDetails {
private final ChecksDetails details;

private static final int MAX_MESSAGE_SIZE_TO_CHECKS_API = 65_535;

/**
* Construct with the given {@link ChecksDetails}.
*
Expand Down Expand Up @@ -171,9 +173,9 @@ public Optional<Output> getOutput() {
Output output = new Output(
checksOutput.getTitle().orElseThrow(
() -> new IllegalArgumentException("Title of output is required but not provided")),
checksOutput.getSummary().orElseThrow(
checksOutput.getSummary(MAX_MESSAGE_SIZE_TO_CHECKS_API).orElseThrow(
() -> new IllegalArgumentException("Summary of output is required but not proviede")))
.withText(checksOutput.getText().orElse(null));
.withText(checksOutput.getText(MAX_MESSAGE_SIZE_TO_CHECKS_API).orElse(null));
checksOutput.getChecksAnnotations().stream().map(this::getAnnotation).forEach(output::add);
checksOutput.getChecksImages().stream().map(this::getImage).forEach(output::add);
return Optional.of(output);
Expand Down

0 comments on commit d78ad8a

Please sign in to comment.