Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: go-playground/webhooks
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.8.0
Choose a base ref
...
head repository: go-playground/webhooks
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5
Choose a head ref

Commits on Apr 17, 2019

  1. Copy the full SHA
    067e3f1 View commit details
  2. Copy the full SHA
    c271d4f View commit details
  3. Copy the full SHA
    ebe6b8d View commit details

Commits on Apr 30, 2019

  1. Merge pull request #69 from hatstand/add-security-advisory

    Add github security advisory event
    Dean Karn authored Apr 30, 2019
    Copy the full SHA
    869ac76 View commit details
  2. Update README.md

    Dean Karn authored Apr 30, 2019
    Copy the full SHA
    d228b48 View commit details

Commits on May 18, 2019

  1. Add support for some additional fields.

    mtail committed May 18, 2019
    Copy the full SHA
    bf1a77d View commit details

Commits on May 19, 2019

  1. Add support for Job Events

    Closes #70, closes #71
    iladin committed May 19, 2019
    Copy the full SHA
    21587e1 View commit details
  2. Merge pull request #72 from geeknoid/v5

    Add support for some additional fields.
    Dean Karn authored May 19, 2019
    Copy the full SHA
    08c3e54 View commit details
  3. Merge pull request #73 from iladin/master

    Add support for Job Events
    Dean Karn authored May 19, 2019
    Copy the full SHA
    c168baf View commit details
  4. Update README.md

    Dean Karn authored May 19, 2019
    Copy the full SHA
    2b63b48 View commit details

Commits on May 20, 2019

  1. Update Pipeline even with jobs

    maguro committed May 20, 2019
    Copy the full SHA
    a8ef776 View commit details
  2. Merge pull request #75 from maguro/v5

    Update PipelineEventPayload with Job
    Dean Karn authored May 20, 2019
    Copy the full SHA
    c205145 View commit details
  3. Update README.md

    Dean Karn authored May 20, 2019
    Copy the full SHA
    6edb377 View commit details

Commits on May 22, 2019

  1. Add repository vulnerability alert event

    jrousseau committed May 22, 2019
    Copy the full SHA
    43ffb31 View commit details

Commits on May 23, 2019

  1. Merge pull request #76 from v4lproik/add-repository-vulnerability-alert

    Add repository vulnerability alert event
    Dean Karn authored May 23, 2019
    Copy the full SHA
    0a9a3aa View commit details
  2. Update README.md

    Dean Karn authored May 23, 2019
    Copy the full SHA
    1751865 View commit details

Commits on Jun 2, 2019

  1. Update position to struct

    Position defines a specific location, identified by paths line numbers and
    image coordinates, within a specific diff, identified by start, head and
    base commit ids.
    
    Text position will have: new_line and old_line
    Image position will have: width, height, x, y
    maguro committed Jun 2, 2019
    Copy the full SHA
    471fb52 View commit details

Commits on Jun 20, 2019

  1. Copy the full SHA
    71b069e View commit details
  2. Copy the full SHA
    905cac7 View commit details

Commits on Jul 2, 2019

  1. Update BitBucket payload

    ilteriş tabak committed Jul 2, 2019
    Copy the full SHA
    a740f8c View commit details

Commits on Jul 8, 2019

  1. Copy the full SHA
    3534f74 View commit details
  2. Reorder field in StatusPayload to match schema

    Riley Martine committed Jul 8, 2019
    Copy the full SHA
    a9a686f View commit details

Commits on Jul 10, 2019

  1. Merge pull request #79 from maguro/v5

    Update position to struct
    Dean Karn authored Jul 10, 2019
    Copy the full SHA
    0c10330 View commit details
  2. Merge pull request #82 from hatstand/add-installation-id

    Add installation ID to pull request payloads
    Dean Karn authored Jul 10, 2019
    Copy the full SHA
    2c92b65 View commit details
  3. Merge pull request #84 from ilteristabak/updated-bb-actor

    Update BitBucket Owner payload
    Dean Karn authored Jul 10, 2019
    Copy the full SHA
    c86c1f1 View commit details
  4. Merge pull request #85 from riley-martine/v5

    Move node_id field from status to status.commit in StatusEvent
    Dean Karn authored Jul 10, 2019
    Copy the full SHA
    cc33de4 View commit details
  5. Update README.md

    Dean Karn authored Jul 10, 2019
    Copy the full SHA
    2c25dbc View commit details

Commits on Aug 1, 2019

  1. Copy the full SHA
    26af15f View commit details

Commits on Aug 21, 2019

  1. Copy the full SHA
    c3faee8 View commit details

Commits on Aug 24, 2019

  1. Copy the full SHA
    dc7efa3 View commit details
  2. Merge pull request #86 from BlizzTom/v5

    Adding support for github event integration_installation_repositories
    Dean Karn authored Aug 24, 2019
    Copy the full SHA
    9ce6db7 View commit details
  3. Merge pull request #87 from pavelgnom/v5

    Add `Installation` to the `ReleasePayload`
    Dean Karn authored Aug 24, 2019
    Copy the full SHA
    115b7e4 View commit details
  4. Merge branch 'v5' into github-meta-event

    Dean Karn authored Aug 24, 2019
    Copy the full SHA
    ef903a2 View commit details
  5. Merge pull request #88 from luca-moser/github-meta-event

    Adds GitHub meta event/payload
    Dean Karn authored Aug 24, 2019
    Copy the full SHA
    e1f5ba4 View commit details
  6. Update README.md

    Dean Karn authored Aug 24, 2019
    Copy the full SHA
    2845fba View commit details

Commits on Sep 28, 2019

  1. Copy the full SHA
    f248671 View commit details

Commits on Oct 26, 2019

  1. Added supported for GitHub pull request comments.

    chhsia0 committed Oct 26, 2019
    Copy the full SHA
    3007a7f View commit details

Commits on Nov 11, 2019

  1. Merge pull request #97 from Toshik1978/v5

    Fixed pipeline hook for GitLab >= 12.3
    Dean Karn authored Nov 11, 2019
    Copy the full SHA
    334436b View commit details
  2. Merge pull request #96 from chhsia0/github-pr-comment

    Added supported for GitHub pull request comments.
    Dean Karn authored Nov 11, 2019
    Copy the full SHA
    cb4aa3d View commit details

Commits on Mar 30, 2020

  1. Copy the full SHA
    cc63869 View commit details

Commits on Apr 5, 2020

  1. Added support draft pull request for github

    Aleksey Andreyanov committed Apr 5, 2020
    Copy the full SHA
    9a9f42e View commit details

Commits on Apr 9, 2020

  1. Copy the full SHA
    a4dc35a View commit details

Commits on Apr 15, 2020

  1. Copy the full SHA
    743f78a View commit details

Commits on Apr 28, 2020

  1. Copy the full SHA
    ef30544 View commit details
  2. supplementary annotation

    yinxulai committed Apr 28, 2020
    Copy the full SHA
    e01b0fd View commit details
  3. restructuring

    yinxulai committed Apr 28, 2020
    Copy the full SHA
    260e9b3 View commit details

Commits on May 2, 2020

  1. Merge pull request #103 from spacelift-io/v5

    Add missing ID for Project
    Toshik1978 authored May 2, 2020
    Copy the full SHA
    bb49f71 View commit details
  2. Merge pull request #108 from yinxulai/v5

    add changes field in to PullRequestPayload of GitHub.
    Toshik1978 authored May 2, 2020
    Copy the full SHA
    7a4edfc View commit details

Commits on May 28, 2020

  1. Copy the full SHA
    7c04644 View commit details

Commits on May 30, 2020

  1. add a system push example

    aritas1 authored May 30, 2020
    Copy the full SHA
    a230622 View commit details
Showing with 1,744 additions and 391 deletions.
  1. +8 −8 .travis.yml
  2. +1 −1 README.md
  3. +10 −5 bitbucket-server/bitbucketserver.go
  4. +8 −0 bitbucket-server/payload.go
  5. +2 −1 bitbucket/payload.go
  6. +53 −37 github/github.go
  7. +42 −2 github/github_test.go
  8. +531 −89 github/payload.go
  9. +15 −1 gitlab/gitlab.go
  10. +12 −3 gitlab/gitlab_test.go
  11. +119 −53 gitlab/payload.go
  12. +4 −3 testdata/bitbucket/commit-comment-created.json
  13. +4 −3 testdata/bitbucket/issue-comment-created.json
  14. +4 −3 testdata/bitbucket/issue-created.json
  15. +4 −3 testdata/bitbucket/issue-updated.json
  16. +24 −18 testdata/bitbucket/pull-request-approval-removed.json
  17. +24 −18 testdata/bitbucket/pull-request-approved.json
  18. +20 −15 testdata/bitbucket/pull-request-comment-created.json
  19. +20 −15 testdata/bitbucket/pull-request-comment-deleted.json
  20. +20 −15 testdata/bitbucket/pull-request-comment-updated.json
  21. +20 −15 testdata/bitbucket/pull-request-created.json
  22. +20 −15 testdata/bitbucket/pull-request-declined.json
  23. +18 −14 testdata/bitbucket/pull-request-merged.json
  24. +20 −15 testdata/bitbucket/pull-request-updated.json
  25. +4 −3 testdata/bitbucket/repo-commit-status-created.json
  26. +4 −3 testdata/bitbucket/repo-commit-status-updated.json
  27. +4 −3 testdata/bitbucket/repo-fork.json
  28. +16 −12 testdata/bitbucket/repo-push.json
  29. +8 −6 testdata/bitbucket/repo-updated.json
  30. +75 −0 testdata/github/integration-installation-repositories.json
  31. +3 −2 testdata/github/project-card.json
  32. +208 −0 testdata/github/pull-request-issue-comment.json
  33. +1 −0 testdata/github/pull-request.json
  34. +33 −0 testdata/github/repository-vulnerability-alert.json
  35. +51 −0 testdata/github/security-advisory.json
  36. +31 −2 testdata/gitlab/confidential-issue-event.json
  37. +31 −2 testdata/gitlab/issue-event.json
  38. +42 −0 testdata/gitlab/job-event.json
  39. +28 −6 testdata/gitlab/pipeline-event.json
  40. +114 −0 testdata/gitlab/system-merge-request-event.json
  41. +50 −0 testdata/gitlab/system-push-event.json
  42. +38 −0 testdata/gitlab/system-tag-event.json
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
language: go
go:
- 1.12.1
- tip
- 1.13.15
- tip
matrix:
allow_failures:
- go: tip

notifications:
email:
recipients: dean.karn@gmail.com
on_success: change
on_failure: always
email:
recipients: dean.karn@gmail.com
on_success: change
on_failure: always

before_install:
- go get -u github.com/go-playground/overalls
@@ -26,9 +26,9 @@ before_script:
- go get -t ./...

script:
- make test
- make test

after_success: |
[ $TRAVIS_GO_VERSION = 1.11.2 ] &&
[ $TRAVIS_GO_VERSION = 1.13.15 ] &&
overalls -project="github.com/go-playground/webhooks" -covermode=count -ignore=.git,_examples,testdata -debug &&
goveralls -coverprofile=overalls.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Library webhooks
================
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v5/logo.png">![Project status](https://img.shields.io/badge/version-5.8.0-green.svg)
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v5/logo.png">![Project status](https://img.shields.io/badge/version-5.17.0-green.svg)
[![Build Status](https://travis-ci.org/go-playground/webhooks.svg?branch=v5)](https://travis-ci.org/go-playground/webhooks)
[![Coverage Status](https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v5&service=github)](https://coveralls.io/github/go-playground/webhooks?branch=v5)
[![Go Report Card](https://goreportcard.com/badge/go-playground/webhooks)](https://goreportcard.com/report/go-playground/webhooks)
15 changes: 10 additions & 5 deletions bitbucket-server/bitbucketserver.go
Original file line number Diff line number Diff line change
@@ -32,11 +32,12 @@ const (
RepositoryCommentEditedEvent Event = "repo:comment:edited"
RepositoryCommentDeletedEvent Event = "repo:comment:deleted"

PullRequestOpenedEvent Event = "pr:opened"
PullRequestModifiedEvent Event = "pr:modified"
PullRequestMergedEvent Event = "pr:merged"
PullRequestDeclinedEvent Event = "pr:declined"
PullRequestDeletedEvent Event = "pr:deleted"
PullRequestOpenedEvent Event = "pr:opened"
PullRequestFromReferenceUpdatedEvent Event = "pr:from_ref_updated"
PullRequestModifiedEvent Event = "pr:modified"
PullRequestMergedEvent Event = "pr:merged"
PullRequestDeclinedEvent Event = "pr:declined"
PullRequestDeletedEvent Event = "pr:deleted"

PullRequestReviewerUpdatedEvent Event = "pr:reviewer:updated"
PullRequestReviewerApprovedEvent Event = "pr:reviewer:approved"
@@ -168,6 +169,10 @@ func (hook *Webhook) Parse(r *http.Request, events ...Event) (interface{}, error
var pl PullRequestOpenedPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case PullRequestFromReferenceUpdatedEvent:
var pl PullRequestFromReferenceUpdatedPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case PullRequestModifiedEvent:
var pl PullRequestModifiedPayload
err = json.Unmarshal([]byte(payload), &pl)
8 changes: 8 additions & 0 deletions bitbucket-server/payload.go
Original file line number Diff line number Diff line change
@@ -66,6 +66,14 @@ type PullRequestOpenedPayload struct {
PullRequest PullRequest `json:"pullRequest"`
}

type PullRequestFromReferenceUpdatedPayload struct {
Date Date `json:"date"`
EventKey Event `json:"eventKey"`
Actor User `json:"actor"`
PullRequest PullRequest `json:"pullRequest"`
PreviousFromHash string `json:"previousFromHash"`
}

type PullRequestModifiedPayload struct {
Date Date `json:"date"`
EventKey Event `json:"eventKey"`
3 changes: 2 additions & 1 deletion bitbucket/payload.go
Original file line number Diff line number Diff line change
@@ -348,8 +348,9 @@ type PullRequestCommentDeletedPayload struct {
// Owner is the common Bitbucket Owner Sub Entity
type Owner struct {
Type string `json:"type"`
Username string `json:"username"`
NickName string `json:"nickname"`
DisplayName string `json:"display_name"`
AccountId string `json:"account_id"`
UUID string `json:"uuid"`
Links struct {
Self struct {
90 changes: 53 additions & 37 deletions github/github.go
Original file line number Diff line number Diff line change
@@ -28,42 +28,46 @@ type Event string

// GitHub hook types
const (
CheckRunEvent Event = "check_run"
CheckSuiteEvent Event = "check_suite"
CommitCommentEvent Event = "commit_comment"
CreateEvent Event = "create"
DeleteEvent Event = "delete"
DeploymentEvent Event = "deployment"
DeploymentStatusEvent Event = "deployment_status"
ForkEvent Event = "fork"
GollumEvent Event = "gollum"
InstallationEvent Event = "installation"
InstallationRepositoriesEvent Event = "installation_repositories"
IntegrationInstallationEvent Event = "integration_installation"
IssueCommentEvent Event = "issue_comment"
IssuesEvent Event = "issues"
LabelEvent Event = "label"
MemberEvent Event = "member"
MembershipEvent Event = "membership"
MilestoneEvent Event = "milestone"
OrganizationEvent Event = "organization"
OrgBlockEvent Event = "org_block"
PageBuildEvent Event = "page_build"
PingEvent Event = "ping"
ProjectCardEvent Event = "project_card"
ProjectColumnEvent Event = "project_column"
ProjectEvent Event = "project"
PublicEvent Event = "public"
PullRequestEvent Event = "pull_request"
PullRequestReviewEvent Event = "pull_request_review"
PullRequestReviewCommentEvent Event = "pull_request_review_comment"
PushEvent Event = "push"
ReleaseEvent Event = "release"
RepositoryEvent Event = "repository"
StatusEvent Event = "status"
TeamEvent Event = "team"
TeamAddEvent Event = "team_add"
WatchEvent Event = "watch"
CheckRunEvent Event = "check_run"
CheckSuiteEvent Event = "check_suite"
CommitCommentEvent Event = "commit_comment"
CreateEvent Event = "create"
DeleteEvent Event = "delete"
DeploymentEvent Event = "deployment"
DeploymentStatusEvent Event = "deployment_status"
ForkEvent Event = "fork"
GollumEvent Event = "gollum"
InstallationEvent Event = "installation"
InstallationRepositoriesEvent Event = "installation_repositories"
IntegrationInstallationEvent Event = "integration_installation"
IntegrationInstallationRepositoriesEvent Event = "integration_installation_repositories"
IssueCommentEvent Event = "issue_comment"
IssuesEvent Event = "issues"
LabelEvent Event = "label"
MemberEvent Event = "member"
MembershipEvent Event = "membership"
MilestoneEvent Event = "milestone"
MetaEvent Event = "meta"
OrganizationEvent Event = "organization"
OrgBlockEvent Event = "org_block"
PageBuildEvent Event = "page_build"
PingEvent Event = "ping"
ProjectCardEvent Event = "project_card"
ProjectColumnEvent Event = "project_column"
ProjectEvent Event = "project"
PublicEvent Event = "public"
PullRequestEvent Event = "pull_request"
PullRequestReviewEvent Event = "pull_request_review"
PullRequestReviewCommentEvent Event = "pull_request_review_comment"
PushEvent Event = "push"
ReleaseEvent Event = "release"
RepositoryEvent Event = "repository"
RepositoryVulnerabilityAlertEvent Event = "repository_vulnerability_alert"
SecurityAdvisoryEvent Event = "security_advisory"
StatusEvent Event = "status"
TeamEvent Event = "team"
TeamAddEvent Event = "team_add"
WatchEvent Event = "watch"
)

// EventSubtype defines a GitHub Hook Event subtype
@@ -204,7 +208,7 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
var pl InstallationPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case InstallationRepositoriesEvent:
case InstallationRepositoriesEvent, IntegrationInstallationRepositoriesEvent:
var pl InstallationRepositoriesPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
@@ -228,6 +232,10 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
var pl MembershipPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case MetaEvent:
var pl MetaPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case MilestoneEvent:
var pl MilestonePayload
err = json.Unmarshal([]byte(payload), &pl)
@@ -288,6 +296,14 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
var pl RepositoryPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case RepositoryVulnerabilityAlertEvent:
var pl RepositoryVulnerabilityAlertPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case SecurityAdvisoryEvent:
var pl SecurityAdvisoryPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case StatusEvent:
var pl StatusPayload
err = json.Unmarshal([]byte(payload), &pl)
44 changes: 42 additions & 2 deletions github/github_test.go
Original file line number Diff line number Diff line change
@@ -253,6 +253,16 @@ func TestWebhooks(t *testing.T) {
"X-Hub-Signature": []string{"sha1=bb2769f05f1a11af3a1edf8f9fac11bae7402a1e"},
},
},
{
name: "IntegrationInstallationRepositoriesEvent",
event: IntegrationInstallationRepositoriesEvent,
typ: InstallationRepositoriesPayload{},
filename: "../testdata/github/integration-installation-repositories.json",
headers: http.Header{
"X-Github-Event": []string{"integration_installation_repositories"},
"X-Hub-Signature": []string{"sha1=2f00a982574188342c2894eb9d1b1e93434687fb"},
},
},
{
name: "IssueCommentEvent",
event: IssueCommentEvent,
@@ -263,6 +273,16 @@ func TestWebhooks(t *testing.T) {
"X-Hub-Signature": []string{"sha1=e724c9f811fcf5f511aac32e4251b08ab1a0fd87"},
},
},
{
name: "PullRequestIssueCommentEvent",
event: IssueCommentEvent,
typ: IssueCommentPayload{},
filename: "../testdata/github/pull-request-issue-comment.json",
headers: http.Header{
"X-Github-Event": []string{"issue_comment"},
"X-Hub-Signature": []string{"sha1=6c969b99ef881b5c98b2dbfc66a34465fcf0e7d4"},
},
},
{
name: "IssuesEvent",
event: IssuesEvent,
@@ -360,7 +380,7 @@ func TestWebhooks(t *testing.T) {
filename: "../testdata/github/project-card.json",
headers: http.Header{
"X-Github-Event": []string{"project_card"},
"X-Hub-Signature": []string{"sha1=495dec0d6449d16b71f2ddcd37d595cb9b04b1d8"},
"X-Hub-Signature": []string{"sha1=f5ed1572b04f0e03c8d5f5e3f7fa63737bef76d7"},
},
},
{
@@ -400,7 +420,7 @@ func TestWebhooks(t *testing.T) {
filename: "../testdata/github/pull-request.json",
headers: http.Header{
"X-Github-Event": []string{"pull_request"},
"X-Hub-Signature": []string{"sha1=35712c8d2bc197b7d07621dcf20d2fb44620508f"},
"X-Hub-Signature": []string{"sha1=88972f972db301178aa13dafaf112d26416a15e6"},
},
},
{
@@ -453,6 +473,26 @@ func TestWebhooks(t *testing.T) {
"X-Hub-Signature": []string{"sha1=df442a8af41edd2d42ccdd997938d1d111b0f94e"},
},
},
{
name: "RepositoryVulnerabilityAlertEvent",
event: RepositoryVulnerabilityAlertEvent,
typ: RepositoryVulnerabilityAlertPayload{},
filename: "../testdata/github/repository-vulnerability-alert.json",
headers: http.Header{
"X-Github-Event": []string{"repository_vulnerability_alert"},
"X-Hub-Signature": []string{"sha1=c42c0649e7e06413bcd756763edbab48dff400db"},
},
},
{
name: "SecurityAdvisoryEvent",
event: SecurityAdvisoryEvent,
typ: SecurityAdvisoryPayload{},
filename: "../testdata/github/security-advisory.json",
headers: http.Header{
"X-Github-Event": []string{"security_advisory"},
"X-Hub-Signature": []string{"sha1=6a71f24fa69f55469843a91dc3a5c3e29714a565"},
},
},
{
name: "StatusEvent",
event: StatusEvent,
Loading