Skip to content

Commit 62d5786

Browse files
authored
Merge pull request #32 from vince-riv/fix/always-comment
chore: always call Comment()
2 parents b1a0175 + 3d3abf1 commit 62d5786

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Diff for: cmd/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func processEvent(eventInfo webhook.EventInfo) {
124124
// send the commit status
125125
github.Status(ctx, isPr, newStatus, statusDescription, eventInfo.RepoOwner, eventInfo.RepoName, eventInfo.Sha, devMode)
126126

127-
if isPr && (changeCount > 0 || errorCount > 0 || unknownCount > 0) {
127+
if isPr {
128128
// if it's a pull-request event, only comment when something has happened
129129
t := time.Now()
130130
tStr := t.Format("3:04PM MST, 2 Jan 2006")

Diff for: internal/github/comment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func Comment(ctx context.Context, owner, repo string, prNum int, commentBodies [
163163
}
164164
for nextExistingCommentIdx < len(existingComments) {
165165
existingComment := existingComments[nextExistingCommentIdx]
166-
truncateCommentBody := "[Refreshed diff content is in above comments]\n\n" + commentIdentifier + "\n"
166+
truncateCommentBody := "[Outdated argo-diff content]\n\n" + commentIdentifier + "\n"
167167
newComment := github.IssueComment{Body: &truncateCommentBody}
168168
issueComment, resp, err := commentClient.Issues.EditComment(ctx, owner, repo, *existingComment.ID, &newComment)
169169
if resp != nil {

Diff for: internal/github/comment_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func TestCommentExistingMulti(t *testing.T) {
251251
if *comments[1].ID != 4444444333 {
252252
t.Errorf("2nd Comment ID doesn't match 4444444333: %d", *comments[1].ID)
253253
}
254-
if !strings.Contains(*comments[1].Body, "Refreshed diff content is in above comments") {
255-
t.Errorf("1st Comment body doesn't match 'Refreshed diff content is in above comments': %s", *comments[1].Body)
254+
if !strings.Contains(*comments[1].Body, "[Outdated argo-diff content]") {
255+
t.Errorf("1st Comment body doesn't match '[Outdated argo-diff content]': %s", *comments[1].Body)
256256
}
257257
}

0 commit comments

Comments
 (0)