ContentForGitHubPost constructs the message covbot posts
(baseProfiles, newProfiles []*cover.Profile, jobName string, coverageThreshold float32)
| 62 | |
| 63 | // ContentForGitHubPost constructs the message covbot posts |
| 64 | func ContentForGitHubPost(baseProfiles, newProfiles []*cover.Profile, jobName string, coverageThreshold float32) ( |
| 65 | string, bool) { |
| 66 | |
| 67 | rows := []string{ |
| 68 | "The following is the code coverage report", |
| 69 | fmt.Sprintf("Say `/test %s` to re-run this coverage report", jobName), |
| 70 | "", |
| 71 | "File | Old Coverage | New Coverage | Delta", |
| 72 | "---- |:------------:|:------------:|:-----:", |
| 73 | } |
| 74 | |
| 75 | table, isCoverageLow := makeTable(calculation.ProduceCovList(baseProfiles), calculation.ProduceCovList(newProfiles), coverageThreshold) |
| 76 | |
| 77 | if table == "" { |
| 78 | return "", false |
| 79 | } |
| 80 | |
| 81 | rows = append(rows, table) |
| 82 | rows = append(rows, "") |
| 83 | |
| 84 | return strings.Join(rows, "\n"), isCoverageLow |
| 85 | } |
no test coverage detected