Repository: palantir/policy-bot
Pull request #253 (2020-12-18 04:08:47)

Excavator: Update godel to latest version
###### _excavator_ is a bot for automating changes across repositories.

Changes produced by the excavator/update-godel-version-oss check.


To enable or disable this check, please contact the maintainers of Excavator.



Patch:
diff --git a/godel/config/godel.properties b/godel/config/godel.properties
index 84f7302..216d678 100644
--- a/godel/config/godel.properties
+++ b/godel/config/godel.properties
@@ -1,2 +1,2 @@
-distributionURL=https://palantir.bintray.com/releases/com/palantir/godel/godel/2.25.0/godel-2.25.0.tgz
-distributionSHA256=f9a58181cfc1c709e9ac4a763bce386fb4e0c5ad24a635120b7d592c60e10206
+distributionURL=https://palantir.bintray.com/releases/com/palantir/godel/godel/2.26.0/godel-2.26.0.tgz
+distributionSHA256=03ae0b15f6c7d04c9250bde58a60f0404f9c4410fb7171f0ee326c658d03f6c7
diff --git a/godelw b/godelw
index d417c2e..221ec0f 100755
--- a/godelw
+++ b/godelw
@@ -3,9 +3,9 @@
 set -euo pipefail
 
 # Version and checksums for godel. Values are populated by the godel "dist" task.
-VERSION=2.25.0
-DARWIN_CHECKSUM=06c92c3b973198c0c4a57c09d853c6f2235d02d4c2098d6303211d31a9c27e5d
-LINUX_CHECKSUM=731d00d75c2607258326f5cbbe3c0b4cdc3e1526c55b3539246094ca2f1a22fc
+VERSION=2.26.0
+DARWIN_CHECKSUM=195d6a32f0fb357d131d444c78b3f49f7ecef2cdfdf00ee707427c76970c45ef
+LINUX_CHECKSUM=2ff4039d95fcb85891d8d9affa0294bcba40ba3b31d7fee34ca31f6f81db9c44
 
 # Downloads file at URL to destination path using wget or curl. Prints an error and exits if wget or curl is not present.
 function download {
diff --git a/pull/github.go b/pull/github.go
index 01cc8f2..b690183 100644
--- a/pull/github.go
+++ b/pull/github.go
@@ -519,7 +519,7 @@ func (ghc *GitHubContext) loadPagedData() error {
 				Reviews struct {
 					PageInfo v4PageInfo
 					Nodes    []v4PullRequestReview
-				} `graphql:"reviews(first: 100, after: $reviewCursor, states: [APPROVED, CHANGES_REQUESTED])"`
+				} `graphql:"reviews(first: 100, after: $reviewCursor, states: [APPROVED, CHANGES_REQUESTED, COMMENTED])"`
 			} `graphql:"pullRequest(number: $number)"`
 		} `graphql:"repository(owner: $owner, name: $name)"`
 	}
@@ -548,7 +548,12 @@ func (ghc *GitHubContext) loadPagedData() error {
 		}
 
 		for _, r := range q.Repository.PullRequest.Reviews.Nodes {
-			reviews = append(reviews, r.ToReview())
+			switch r.State {
+			case "COMMENTED":
+				comments = append(comments, r.ToComment())
+			case "APPROVED", "CHANGES_REQUESTED":
+				reviews = append(reviews, r.ToReview())
+			}
 		}
 		if !q.Repository.PullRequest.Reviews.PageInfo.UpdateCursor(qvars, "reviewCursor") {
 			complete++
@@ -784,6 +789,14 @@ func (r *v4PullRequestReview) ToReview() *Review {
 	}
 }
 
+func (r *v4PullRequestReview) ToComment() *Comment {
+	return &Comment{
+		CreatedAt: r.SubmittedAt,
+		Author:    r.Author.GetV3Login(),
+		Body:      r.Body,
+	}
+}
+
 type v4IssueComment struct {
 	Author    v4Actor
 	Body      string


Test patch:
diff --git a/pull/github_test.go b/pull/github_test.go
index 2a09c42..689c3d2 100644
--- a/pull/github_test.go
+++ b/pull/github_test.go
@@ -241,7 +241,7 @@ func TestComments(t *testing.T) {
 	comments, err := ctx.Comments()
 	require.NoError(t, err)
 
-	require.Len(t, comments, 2, "incorrect number of comments")
+	require.Len(t, comments, 3, "incorrect number of comments")
 	assert.Equal(t, 2, dataRule.Count, "no http request was made")
 
 	expectedTime, err := time.Parse(time.RFC3339, "2018-06-27T20:28:22Z")
@@ -255,11 +255,15 @@ func TestComments(t *testing.T) {
 	assert.Equal(t, expectedTime.Add(time.Minute), comments[1].CreatedAt)
 	assert.Equal(t, "I merge!", comments[1].Body)
 
+	assert.Equal(t, "jgiannuzzi", comments[2].Author)
+	assert.Equal(t, expectedTime.Add(10*time.Minute), comments[2].CreatedAt)
+	assert.Equal(t, "A review comment", comments[2].Body)
+
 	// verify that the commit list is cached
 	comments, err = ctx.Comments()
 	require.NoError(t, err)
 
-	require.Len(t, comments, 2, "incorrect number of comments")
+	require.Len(t, comments, 3, "incorrect number of comments")
 	assert.Equal(t, 2, dataRule.Count, "cached comments were not used")
 }
 
@@ -359,7 +363,7 @@ func TestMixedReviewCommentPaging(t *testing.T) {
 	require.NoError(t, err)
 
 	assert.Equal(t, 2, dataRule.Count, "cached values were not used")
-	assert.Len(t, comments, 2, "incorrect number of comments")
+	assert.Len(t, comments, 3, "incorrect number of comments")
 	assert.Len(t, reviews, 2, "incorrect number of reviews")
 }
 
diff --git a/pull/testdata/responses/pull_comments.yml b/pull/testdata/responses/pull_comments.yml
index 83cdd80..44871b4 100644
--- a/pull/testdata/responses/pull_comments.yml
+++ b/pull/testdata/responses/pull_comments.yml
@@ -20,6 +20,22 @@
                   "createdAt": "2018-06-27T20:28:22Z"
                 }
               ]
+            },
+            "reviews": {
+              "pageInfo": {
+                "endCursor": "2",
+                "hasNextPage": true
+              },
+              "nodes": [
+                {
+                  "author": {
+                    "login": "mhaypenny"
+                  },
+                  "state": "CHANGES_REQUESTED",
+                  "body": "",
+                  "submittedAt": "2018-06-27T20:33:26Z"
+                }
+              ]
             }
           }
         }
@@ -47,6 +63,30 @@
                   "createdAt": "2018-06-27T20:29:22Z"
                 }
               ]
+            },
+            "reviews": {
+              "pageInfo": {
+                "endCursor": "3",
+                "hasNextPage": false
+              },
+              "nodes": [
+                {
+                  "author": {
+                    "login": "bkeyes"
+                  },
+                  "state": "APPROVED",
+                  "body": "the body",
+                  "submittedAt": "2018-06-27T20:33:27Z"
+                },
+                {
+                  "author": {
+                    "login": "jgiannuzzi"
+                  },
+                  "state": "COMMENTED",
+                  "body": "A review comment",
+                  "submittedAt": "2018-06-27T20:38:22Z"
+                }
+              ]
             }
           }
         }
diff --git a/pull/testdata/responses/pull_reviews.yml b/pull/testdata/responses/pull_reviews.yml
index 80de094..173372e 100644
--- a/pull/testdata/responses/pull_reviews.yml
+++ b/pull/testdata/responses/pull_reviews.yml
@@ -45,6 +45,14 @@
                   "state": "APPROVED",
                   "body": "the body",
                   "submittedAt": "2018-06-27T20:33:27Z"
+                },
+                {
+                  "author": {
+                    "login": "jgiannuzzi"
+                  },
+                  "state": "COMMENTED",
+                  "body": "A review comment",
+                  "submittedAt": "2018-06-27T20:38:22Z"
                 }
               ]
             }
diff --git a/pull/testdata/responses/pull_reviews_comments.yml b/pull/testdata/responses/pull_reviews_comments.yml
index b2e975e..b538626 100644
--- a/pull/testdata/responses/pull_reviews_comments.yml
+++ b/pull/testdata/responses/pull_reviews_comments.yml
@@ -76,6 +76,14 @@
                   "state": "APPROVED",
                   "body": "the body",
                   "submittedAt": "2018-06-27T20:33:27Z"
+                },
+                {
+                  "author": {
+                    "login": "jgiannuzzi"
+                  },
+                  "state": "COMMENTED",
+                  "body": "A review comment",
+                  "submittedAt": "2018-06-27T20:38:22Z"
                 }
               ]
             }