Skip to content

Commit

Permalink
Reverted mod changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-harness committed Dec 31, 2020
1 parent 96229b0 commit 38ebedc
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 143 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/drone/go-scm

require (
github.com/google/go-cmp v0.5.4
github.com/google/go-cmp v0.2.0
github.com/h2non/gock v1.0.9
)

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/h2non/gock v1.0.9 h1:17gCehSo8ZOgEsFKpQgqHiR7VLyjxdAG3lkhVvO9QZU=
github.com/h2non/gock v1.0.9/go.mod h1:CZMcB0Lg5IWnr9bF79pPMg9WeV6WumxQiUJ1UvdO1iE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
2 changes: 2 additions & 0 deletions scm/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const (
// pull requests
ActionSync
ActionMerge
// issue comment
ActionEdit
)

// String returns the string representation of Action.
Expand Down
226 changes: 113 additions & 113 deletions scm/driver/github/testdata/webhooks/comment.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions scm/driver/github/testdata/webhooks/comment.json.golden
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"Action": "",
"Action": "created",
"Repo": {
"ID": "309651765",
"Namespace": "wings-software",
"Name": "harness-ci-webhook-test",
"Namespace": "abc",
"Name": "def-ci-webhook-test",
"Perm": null,
"Branch": "master",
"Private": true,
"Visibility": 0,
"Clone": "https://github.com/wings-software/harness-ci-webhook-test.git",
"CloneSSH": "[email protected]:wings-software/harness-ci-webhook-test.git",
"Link": "https://github.com/wings-software/harness-ci-webhook-test",
"Clone": "https://github.com/abc/def-ci-webhook-test.git",
"CloneSSH": "[email protected]:abc/def-ci-webhook-test.git",
"Link": "https://github.com/abc/def-ci-webhook-test",
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
},
"Issue": {
"Number": 2,
"Title": "Update README.md",
"Body": "",
"Link": "https://github.com/wings-software/harness-ci-webhook-test/pull/2",
"Link": "https://github.com/abc/def-ci-webhook-test/pull/2",
"Labels": null,
"Closed": false,
"Locked": false,
"Author": {
"Login": "aman-harness",
"Login": "lts-def",
"Name": "",
"Email": "",
"Avatar": "https://avatars0.githubusercontent.com/u/10278482?v=4",
Expand All @@ -37,7 +37,7 @@
"ID": 751955664,
"Body": "trigger abc",
"Author": {
"Login": "aman-harness",
"Login": "lts-def",
"Name": "",
"Email": "",
"Avatar": "https://avatars0.githubusercontent.com/u/10278482?v=4",
Expand All @@ -48,7 +48,7 @@
"Updated": "2020-12-29T05:49:14Z"
},
"Sender": {
"Login": "aman-harness",
"Login": "lts-def",
"Name": "",
"Email": "",
"Avatar": "https://avatars0.githubusercontent.com/u/10278482?v=4",
Expand Down
20 changes: 5 additions & 15 deletions scm/driver/github/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,12 @@ func (s *webhookService) parseIssueCommentHook(data []byte) (scm.Webhook, error)
}
dst := convertIssueCommentHook(src)
switch src.Action {
case "labeled":
dst.Action = scm.ActionLabel
case "unlabeled":
dst.Action = scm.ActionUnlabel
case "opened":
dst.Action = scm.ActionOpen
case "created":
dst.Action = scm.ActionCreate
case "edited":
dst.Action = scm.ActionUpdate
case "closed":
dst.Action = scm.ActionClose
case "reopened":
dst.Action = scm.ActionReopen
case "synchronize":
dst.Action = scm.ActionSync
case "assigned", "unassigned", "review_requested", "review_request_removed", "ready_for_review", "locked", "unlocked":
dst.Action = scm.ActionUnknown
dst.Action = scm.ActionEdit
case "deleted":
dst.Action = scm.ActionDelete
default:
dst.Action = scm.ActionUnknown
}
Expand Down
8 changes: 6 additions & 2 deletions scm/driver/github/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ func TestWebhooks(t *testing.T) {
obj: new(scm.BranchHook),
},

// commit branch delete
//
// comment events
//

// issue_comment
{
event: "issue_comment",
before: "testdata/webhooks/comment.json",
after: "testdata/webhooks/comment.json.golden",
obj: new(scm.BranchHook),
obj: new(scm.IssueCommentHook),
},

//
Expand Down

0 comments on commit 38ebedc

Please sign in to comment.