Skip to content

Commit 7d0f52b

Browse files
committed
Issue #170: Added field mapping for repository edited, renamed and transfer event.
1 parent 4f72f9c commit 7d0f52b

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

github/github_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,16 @@ func TestWebhooks(t *testing.T) {
483483
"X-Hub-Signature": []string{"sha1=df442a8af41edd2d42ccdd997938d1d111b0f94e"},
484484
},
485485
},
486+
{
487+
name: "RepositoryEditedEvent",
488+
event: RepositoryEvent,
489+
typ: RepositoryPayload{},
490+
filename: "../testdata/github/repository-edited.json",
491+
headers: http.Header{
492+
"X-Github-Event": []string{"repository"},
493+
"X-Hub-Signature": []string{"sha1=4edb36f8c0a8e3905e340c7af4b3af9a21d93acc"},
494+
},
495+
},
486496
{
487497
name: "RepositoryVulnerabilityAlertEvent",
488498
event: RepositoryVulnerabilityAlertEvent,

github/payload.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5431,7 +5431,29 @@ type ReleasePayload struct {
54315431

54325432
// RepositoryPayload contains the information for GitHub's repository hook event
54335433
type RepositoryPayload struct {
5434-
Action string `json:"action"`
5434+
Action string `json:"action"`
5435+
Changes struct {
5436+
DefaultBranch struct {
5437+
From string `json:"from"`
5438+
} `json:"default_branch,omitempty"`
5439+
Description struct {
5440+
From string `json:"from"`
5441+
} `json:"description,omitempty"`
5442+
Homepage struct {
5443+
From string `json:"from"`
5444+
} `json:"homepage,omitempty"`
5445+
Topics struct {
5446+
From string `json:"from,omitempty"`
5447+
} `json:"topics,omitempty"`
5448+
Repository struct {
5449+
Name struct {
5450+
From string `json:"from"`
5451+
} `json:"name"`
5452+
} `json:"repository,omitempty"`
5453+
Owner struct {
5454+
From string `json:"from"`
5455+
} `json:"owner,omitempty"`
5456+
} `json:"changes,omitempty"`
54355457
Repository struct {
54365458
ID int64 `json:"id"`
54375459
NodeID string `json:"node_id"`

0 commit comments

Comments
 (0)