Skip to content

Commit f8afbbb

Browse files
committed
Repository Transferred event
1 parent 0dc3700 commit f8afbbb

File tree

3 files changed

+209
-0
lines changed

3 files changed

+209
-0
lines changed

src/main/java/org/kohsuke/github/GHEventPayload.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,28 @@ public GHRepositoryChanges getChanges() {
14641464

14651465
public static class GHRepositoryChanges {
14661466
private FromRepository repository;
1467+
private Owner owner;
1468+
1469+
public Owner getOwner() {
1470+
return owner;
1471+
}
1472+
1473+
public static class Owner {
1474+
private FromOwner from;
1475+
1476+
public FromOwner getFrom() {
1477+
return from;
1478+
}
1479+
}
1480+
1481+
public static class FromOwner {
1482+
private GHUser user;
1483+
1484+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected")
1485+
public GHUser getUser() {
1486+
return user;
1487+
}
1488+
}
14671489

14681490
public FromRepository getRepository() {
14691491
return repository;

src/test/java/org/kohsuke/github/GHEventPayloadTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,16 @@ public void repository_renamed() throws Exception {
784784
assertThat(event.getSender().getLogin(), is("egoh"));
785785
}
786786

787+
@Test
788+
public void repository_transferred() throws Exception {
789+
final GHEventPayload.RepositoryChanges event = GitHub.offline()
790+
.parseEventPayload(payload.asReader(), GHEventPayload.RepositoryChanges.class);
791+
assertThat(event.getAction(), is("transferred"));
792+
assertThat(event.getChanges().getOwner().getFrom().getUser().getLogin(), is("egoh"));
793+
assertThat(event.getChanges().getOwner().getFrom().getUser().getId(), is(30L));
794+
assertThat(event.getChanges().getOwner().getFrom().getUser().getType(), is("User"));
795+
}
796+
787797
/**
788798
* Status.
789799
*
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
{
2+
"action": "transferred",
3+
"changes": {
4+
"owner": {
5+
"from": {
6+
"user": {
7+
"login": "egoh",
8+
"id": 30,
9+
"node_id": "MDQ6VXNlcjMw",
10+
"avatar_url": "https://github-staging.netflix.net/avatars/u/30?",
11+
"gravatar_id": "",
12+
"url": "https://github-staging.netflix.net/api/v3/users/egoh",
13+
"html_url": "https://github-staging.netflix.net/egoh",
14+
"followers_url": "https://github-staging.netflix.net/api/v3/users/egoh/followers",
15+
"following_url": "https://github-staging.netflix.net/api/v3/users/egoh/following{/other_user}",
16+
"gists_url": "https://github-staging.netflix.net/api/v3/users/egoh/gists{/gist_id}",
17+
"starred_url": "https://github-staging.netflix.net/api/v3/users/egoh/starred{/owner}{/repo}",
18+
"subscriptions_url": "https://github-staging.netflix.net/api/v3/users/egoh/subscriptions",
19+
"organizations_url": "https://github-staging.netflix.net/api/v3/users/egoh/orgs",
20+
"repos_url": "https://github-staging.netflix.net/api/v3/users/egoh/repos",
21+
"events_url": "https://github-staging.netflix.net/api/v3/users/egoh/events{/privacy}",
22+
"received_events_url": "https://github-staging.netflix.net/api/v3/users/egoh/received_events",
23+
"type": "User",
24+
"site_admin": true
25+
}
26+
}
27+
}
28+
},
29+
"repository": {
30+
"id": 52124,
31+
"node_id": "MDEwOlJlcG9zaXRvcnk1MjEyNA==",
32+
"name": "egoh-test-repo-2",
33+
"full_name": "corp/egoh-test-repo-2",
34+
"private": false,
35+
"owner": {
36+
"login": "corp",
37+
"id": 5,
38+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU=",
39+
"avatar_url": "https://github-staging.netflix.net/avatars/u/5?",
40+
"gravatar_id": "",
41+
"url": "https://github-staging.netflix.net/api/v3/users/corp",
42+
"html_url": "https://github-staging.netflix.net/corp",
43+
"followers_url": "https://github-staging.netflix.net/api/v3/users/corp/followers",
44+
"following_url": "https://github-staging.netflix.net/api/v3/users/corp/following{/other_user}",
45+
"gists_url": "https://github-staging.netflix.net/api/v3/users/corp/gists{/gist_id}",
46+
"starred_url": "https://github-staging.netflix.net/api/v3/users/corp/starred{/owner}{/repo}",
47+
"subscriptions_url": "https://github-staging.netflix.net/api/v3/users/corp/subscriptions",
48+
"organizations_url": "https://github-staging.netflix.net/api/v3/users/corp/orgs",
49+
"repos_url": "https://github-staging.netflix.net/api/v3/users/corp/repos",
50+
"events_url": "https://github-staging.netflix.net/api/v3/users/corp/events{/privacy}",
51+
"received_events_url": "https://github-staging.netflix.net/api/v3/users/corp/received_events",
52+
"type": "Organization",
53+
"site_admin": false
54+
},
55+
"html_url": "https://github-staging.netflix.net/corp/egoh-test-repo-2",
56+
"description": null,
57+
"fork": false,
58+
"url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2",
59+
"forks_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/forks",
60+
"keys_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/keys{/key_id}",
61+
"collaborators_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/collaborators{/collaborator}",
62+
"teams_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/teams",
63+
"hooks_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/hooks",
64+
"issue_events_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/issues/events{/number}",
65+
"events_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/events",
66+
"assignees_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/assignees{/user}",
67+
"branches_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/branches{/branch}",
68+
"tags_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/tags",
69+
"blobs_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/git/blobs{/sha}",
70+
"git_tags_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/git/tags{/sha}",
71+
"git_refs_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/git/refs{/sha}",
72+
"trees_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/git/trees{/sha}",
73+
"statuses_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/statuses/{sha}",
74+
"languages_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/languages",
75+
"stargazers_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/stargazers",
76+
"contributors_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/contributors",
77+
"subscribers_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/subscribers",
78+
"subscription_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/subscription",
79+
"commits_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/commits{/sha}",
80+
"git_commits_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/git/commits{/sha}",
81+
"comments_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/comments{/number}",
82+
"issue_comment_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/issues/comments{/number}",
83+
"contents_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/contents/{+path}",
84+
"compare_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/compare/{base}...{head}",
85+
"merges_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/merges",
86+
"archive_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/{archive_format}{/ref}",
87+
"downloads_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/downloads",
88+
"issues_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/issues{/number}",
89+
"pulls_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/pulls{/number}",
90+
"milestones_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/milestones{/number}",
91+
"notifications_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/notifications{?since,all,participating}",
92+
"labels_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/labels{/name}",
93+
"releases_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/releases{/id}",
94+
"deployments_url": "https://github-staging.netflix.net/api/v3/repos/corp/egoh-test-repo-2/deployments",
95+
"created_at": "2024-04-19T21:47:45Z",
96+
"updated_at": "2024-04-19T21:48:07Z",
97+
"pushed_at": "2024-04-19T21:47:46Z",
98+
"git_url": "git://github-staging.netflix.net/corp/egoh-test-repo-2.git",
99+
"ssh_url": "git@github-staging.netflix.net:corp/egoh-test-repo-2.git",
100+
"clone_url": "https://github-staging.netflix.net/corp/egoh-test-repo-2.git",
101+
"svn_url": "https://github-staging.netflix.net/corp/egoh-test-repo-2",
102+
"homepage": null,
103+
"size": 0,
104+
"stargazers_count": 0,
105+
"watchers_count": 0,
106+
"language": null,
107+
"has_issues": true,
108+
"has_projects": true,
109+
"has_downloads": true,
110+
"has_wiki": true,
111+
"has_pages": false,
112+
"has_discussions": false,
113+
"forks_count": 0,
114+
"mirror_url": null,
115+
"archived": false,
116+
"disabled": false,
117+
"open_issues_count": 0,
118+
"license": null,
119+
"allow_forking": true,
120+
"is_template": false,
121+
"web_commit_signoff_required": false,
122+
"topics": [
123+
124+
],
125+
"visibility": "public",
126+
"forks": 0,
127+
"open_issues": 0,
128+
"watchers": 0,
129+
"default_branch": "main"
130+
},
131+
"organization": {
132+
"login": "corp",
133+
"id": 5,
134+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU=",
135+
"url": "https://github-staging.netflix.net/api/v3/orgs/corp",
136+
"repos_url": "https://github-staging.netflix.net/api/v3/orgs/corp/repos",
137+
"events_url": "https://github-staging.netflix.net/api/v3/orgs/corp/events",
138+
"hooks_url": "https://github-staging.netflix.net/api/v3/orgs/corp/hooks",
139+
"issues_url": "https://github-staging.netflix.net/api/v3/orgs/corp/issues",
140+
"members_url": "https://github-staging.netflix.net/api/v3/orgs/corp/members{/member}",
141+
"public_members_url": "https://github-staging.netflix.net/api/v3/orgs/corp/public_members{/member}",
142+
"avatar_url": "https://github-staging.netflix.net/avatars/u/5?",
143+
"description": null
144+
},
145+
"enterprise": {
146+
"id": 1,
147+
"slug": "netflix",
148+
"name": "Netflix",
149+
"node_id": "MDEwOkVudGVycHJpc2Ux",
150+
"avatar_url": "https://github-staging.netflix.net/avatars/b/1?",
151+
"description": null,
152+
"website_url": null,
153+
"html_url": "https://github-staging.netflix.net/enterprises/netflix",
154+
"created_at": "2023-10-12T06:56:57Z",
155+
"updated_at": "2023-11-08T18:37:49Z"
156+
},
157+
"sender": {
158+
"login": "egoh",
159+
"id": 30,
160+
"node_id": "MDQ6VXNlcjMw",
161+
"avatar_url": "https://github-staging.netflix.net/avatars/u/30?",
162+
"gravatar_id": "",
163+
"url": "https://github-staging.netflix.net/api/v3/users/egoh",
164+
"html_url": "https://github-staging.netflix.net/egoh",
165+
"followers_url": "https://github-staging.netflix.net/api/v3/users/egoh/followers",
166+
"following_url": "https://github-staging.netflix.net/api/v3/users/egoh/following{/other_user}",
167+
"gists_url": "https://github-staging.netflix.net/api/v3/users/egoh/gists{/gist_id}",
168+
"starred_url": "https://github-staging.netflix.net/api/v3/users/egoh/starred{/owner}{/repo}",
169+
"subscriptions_url": "https://github-staging.netflix.net/api/v3/users/egoh/subscriptions",
170+
"organizations_url": "https://github-staging.netflix.net/api/v3/users/egoh/orgs",
171+
"repos_url": "https://github-staging.netflix.net/api/v3/users/egoh/repos",
172+
"events_url": "https://github-staging.netflix.net/api/v3/users/egoh/events{/privacy}",
173+
"received_events_url": "https://github-staging.netflix.net/api/v3/users/egoh/received_events",
174+
"type": "User",
175+
"site_admin": true
176+
}
177+
}

0 commit comments

Comments
 (0)