Skip to content

Commit c86e68c

Browse files
Merge pull request #662 from jenkinsci/GH-647
Avoid posting a comment for empty comment files
2 parents 9e25d77 + 6bfdf3b commit c86e68c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/jenkinsci/plugins/ghprb/extensions/comments/GhprbCommentFile.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ public String postBuildComment(Run<?, ?> build, TaskListener listener) {
5959
if (content == null) {
6060
content = FileUtils.readFileToString(new File(scriptFilePathResolved));
6161
}
62-
msg.append(content);
62+
63+
if (content.length() > 0) {
64+
msg.append(content);
65+
}
66+
6367
} catch (IOException e) {
6468
msg.append("\n!!! Couldn't read commit file !!!\n");
6569
listener.getLogger().println("Couldn't read comment file at " + scriptFilePathResolved);

0 commit comments

Comments
 (0)