Skip to content

Commit 62c1da9

Browse files
committed
address review: remove timed_out, update template text
1 parent 02e7c30 commit 62c1da9

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

issuegenerator/internal/github/client.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,25 @@ const (
5353
issueBodyTemplate = `
5454
Auto-generated report for ${jobName} job build.
5555
56-
Link to failed build: ${linkToBuild}
56+
Failing job(s): ${linkToBuild}
5757
Commit: ${commit}
5858
PR: ${prNumber}
5959
6060
### Component(s)
6161
${component}
6262
63+
The following tests failed:
6364
${failedTests}
6465
6566
**Note**: Information about any subsequent build failures that happen while
6667
this issue is open, will be added as comments with more information to this issue.
6768
`
6869
issueCommentTemplate = `
69-
Link to latest failed build: ${linkToBuild}
70+
Failing job(s): ${linkToBuild}
7071
Commit: ${commit}
7172
PR: ${prNumber}
7273
74+
The following tests failed:
7375
${failedTests}
7476
`
7577
prCommentTemplate = `@${prAuthor} some tests are failing on main after these changes.
@@ -330,7 +332,7 @@ func (c *Client) getFailedJobURLs(ctx context.Context, runID int64) (map[string]
330332
return nil, err
331333
}
332334
for _, job := range jobs.Jobs {
333-
if job.GetConclusion() == "failure" || job.GetConclusion() == "timed_out" {
335+
if job.GetConclusion() == "failure" {
334336
failedJobs[job.GetName()] = job.GetHTMLURL()
335337
}
336338
}
@@ -531,7 +533,7 @@ func (c *Client) CreateIssue(ctx context.Context, r report.Report) *github.Issue
531533
c.handleBadResponses(response)
532534
}
533535

534-
// After creating the issue, also comment on the PR with a link to the created issue
536+
// After creating the issue, also comment on the PR with a link to the created issue
535537
if prNumber > 0 && issue != nil && issue.HTMLURL != nil {
536538
if prAuthor := c.GetPRAuthor(ctx, prNumber); prAuthor != "" {
537539
_ = c.CommentOnPR(ctx, prNumber, prAuthor, *issue.HTMLURL)

issuegenerator/internal/github/client_test.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,14 @@ func TestTemplateExpansion(t *testing.T) {
118118
expected: `
119119
Auto-generated report for ` + "`test-ci`" + ` job build.
120120
121-
Link to failed build: https://github.com/test-org/test-repo/actions/runs/555555
121+
Failing job(s): https://github.com/test-org/test-repo/actions/runs/555555
122122
Commit: abcde12
123123
PR: N/A
124124
125125
### Component(s)
126126
` + "package1" + `
127127
128+
The following tests failed:
128129
#### Test Failures
129130
- ` + "`TestFailure`" + `
130131
` + "```" + `
@@ -142,10 +143,11 @@ this issue is open, will be added as comments with more information to this issu
142143
name: "issue comment template",
143144
template: issueCommentTemplate,
144145
expected: `
145-
Link to latest failed build: https://github.com/test-org/test-repo/actions/runs/555555
146+
Failing job(s): https://github.com/test-org/test-repo/actions/runs/555555
146147
Commit: abcde12
147148
PR: N/A
148149
150+
The following tests failed:
149151
#### Test Failures
150152
- ` + "`TestFailure`" + `
151153
` + "```" + `
@@ -428,15 +430,6 @@ func TestGetFailedJobURLs(t *testing.T) {
428430
]}`,
429431
expected: map[string]string{"Lint": "http://job/1", "Test-Linux": "http://job/2"},
430432
},
431-
{
432-
name: "timed_out treated as failure",
433-
runID: 123,
434-
mockResponse: `{"jobs": [
435-
{"id": 1, "name": "Success Job", "conclusion": "success", "html_url": "http://job/1"},
436-
{"id": 2, "name": "Timeout Job", "conclusion": "timed_out", "html_url": "http://job/2"}
437-
]}`,
438-
expected: map[string]string{"Timeout Job": "http://job/2"},
439-
},
440433
{
441434
name: "no failures found",
442435
runID: 123,

0 commit comments

Comments
 (0)