private String getComment()

in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/github/ChangeStatusUpdater.java [513:567]


    private String getComment(@NotNull SBuild build, boolean completed, String viewUrl) {
      final StringBuilder comment = new StringBuilder();
      comment.append("TeamCity ");
      final SBuildType bt = build.getBuildType();
      if (bt != null) {
        comment.append(bt.getFullName());
      }
      comment.append(" [Build ");
      comment.append(build.getBuildNumber());
      comment.append("](");
      comment.append(viewUrl);
      comment.append(") ");

      if (completed) {
        comment.append("outcome was **").append(build.getStatusDescriptor().getStatus().getText()).append("**");
      } else {
        comment.append("is now running");
      }

      comment.append("\n");

      final String text = build.getStatusDescriptor().getText();
      if (completed && text != null) {
        comment.append("Summary: ");
        comment.append(text);
        comment.append(" Build time: ");
        comment.append(getFriendlyDuration(build.getDuration()));

        if (build.getBuildStatus() != Status.NORMAL) {

          BuildStatistics stats = build.getBuildStatistics(BuildStatisticsOptions.ALL_TESTS_NO_DETAILS);
          final List<STestRun> failedTests = stats.getFailedTests();
          if (!failedTests.isEmpty()) {
            comment.append("\n### Failed tests\n");
            comment.append("```\n");

            for (int i = 0; i < failedTests.size(); i++) {
              final STestRun testRun = failedTests.get(i);
              comment.append(testRun.getTest().getName());
              comment.append("\n");

              if (i == 10) {
                comment.append("\n##### there are ")
                       .append(stats.getFailedTestCount() - i)
                       .append(" more failed tests, see build details\n");
                break;
              }
            }
            comment.append("```\n");
          }
        }
      }

      return comment.toString();
    }