From fc186d02506830088b23b3bdfecebe30ce31d2b1 Mon Sep 17 00:00:00 2001 From: Alexander Solovyov Date: Fri, 14 Apr 2023 11:14:03 +0300 Subject: [PATCH] github has changed webhooker format --- tests/example.json | 5 +---- tests/other.json | 4 +--- webhooker.go | 13 ++++++------- webhooker_test.go | 4 ++-- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/tests/example.json b/tests/example.json index 7a13cf6..4f80ff1 100644 --- a/tests/example.json +++ b/tests/example.json @@ -129,11 +129,8 @@ "language":"Ruby", "master_branch":"master", "name":"testing", + "full_name": "octokitty/testing", "open_issues":2, - "owner":{ - "email":"lolwut@noway.biz", - "name":"octokitty" - }, "private":false, "pushed_at":1363295520, "size":2156, diff --git a/tests/other.json b/tests/other.json index 13ba9d5..1c73d51 100644 --- a/tests/other.json +++ b/tests/other.json @@ -2,9 +2,7 @@ "ref":"refs/heads/lolster", "repository": { "name":"other", - "owner":{ - "name":"hellothere" - } + "full_name": "hellothere/other" }, "commits":[ { diff --git a/webhooker.go b/webhooker.go index 5923e12..be23288 100644 --- a/webhooker.go +++ b/webhooker.go @@ -53,15 +53,14 @@ type Config []Rule /// Github types type GithubUser struct { - Name string - Email string + Name string } type GithubRepo struct { - Name string - Url string - Private bool - Owner GithubUser + FullName string `json:"full_name"` + Name string + Url string + Private bool } type GithubCommit struct { @@ -79,7 +78,7 @@ type GithubPayload struct { } func (g *GithubPayload) RepoName() string { - return g.Repository.Owner.Name + "/" + g.Repository.Name + return g.Repository.FullName } func (g *GithubPayload) BranchName() string { diff --git a/webhooker_test.go b/webhooker_test.go index aecb319..abdb0fa 100644 --- a/webhooker_test.go +++ b/webhooker_test.go @@ -30,8 +30,8 @@ func TestRunIsCalled(t *testing.T) { data := &GithubPayload{ Ref: "refs/heads/master", Repository: GithubRepo{ - Name: "webhooker", - Owner: GithubUser{Name: "piranha"}, + Name: "webhooker", + FullName: "piranha/webhooker", }, }