Skip to content

Commit

Permalink
github has changed webhooker format
Browse files Browse the repository at this point in the history
  • Loading branch information
piranha committed Apr 14, 2023
1 parent 76c8fa3 commit fc186d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
5 changes: 1 addition & 4 deletions tests/example.json
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions tests/other.json
Expand Up @@ -2,9 +2,7 @@
"ref":"refs/heads/lolster",
"repository": {
"name":"other",
"owner":{
"name":"hellothere"
}
"full_name": "hellothere/other"
},
"commits":[
{
Expand Down
13 changes: 6 additions & 7 deletions webhooker.go
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions webhooker_test.go
Expand Up @@ -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",
},
}

Expand Down

0 comments on commit fc186d0

Please sign in to comment.