-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1836 from eleanorgoh/main
Support repository renamed and transferred in event payload
- Loading branch information
Showing
6 changed files
with
629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
src/main/java/org/kohsuke/github/GHRepositoryChanges.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package org.kohsuke.github; | ||
|
||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
|
||
/** | ||
* Changes made to a repository. | ||
*/ | ||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD" }, justification = "JSON API") | ||
public class GHRepositoryChanges { | ||
private FromRepository repository; | ||
private Owner owner; | ||
|
||
/** | ||
* Get outer owner object. | ||
* | ||
* @return Owner | ||
*/ | ||
public Owner getOwner() { | ||
return owner; | ||
} | ||
|
||
/** | ||
* Outer object of owner from whom this repository was transferred. | ||
*/ | ||
public static class Owner { | ||
private FromOwner from; | ||
|
||
/** | ||
* Get in owner object. | ||
* | ||
* @return FromOwner | ||
*/ | ||
public FromOwner getFrom() { | ||
return from; | ||
} | ||
} | ||
|
||
/** | ||
* Owner from whom this repository was transferred. | ||
*/ | ||
public static class FromOwner { | ||
private GHUser user; | ||
private GHOrganization organization; | ||
|
||
/** | ||
* Get user from which this repository was transferred. | ||
* | ||
* @return user | ||
*/ | ||
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected") | ||
public GHUser getUser() { | ||
return user; | ||
} | ||
|
||
/** | ||
* Get organization from which this repository was transferred. | ||
* | ||
* @return GHOrganization | ||
*/ | ||
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected") | ||
public GHOrganization getOrganization() { | ||
return organization; | ||
} | ||
} | ||
|
||
/** | ||
* Get repository. | ||
* | ||
* @return FromRepository | ||
*/ | ||
public FromRepository getRepository() { | ||
return repository; | ||
} | ||
|
||
/** | ||
* Repository object from which the name was changed. | ||
*/ | ||
public static class FromRepository { | ||
private FromName name; | ||
|
||
/** | ||
* Get top level object for the previous name of the repository. | ||
* | ||
* @return FromName | ||
*/ | ||
public FromName getName() { | ||
return name; | ||
} | ||
} | ||
|
||
/** | ||
* Repository name that was changed. | ||
*/ | ||
public static class FromName { | ||
private String from; | ||
|
||
/** | ||
* Get previous name of the repository before rename. | ||
* | ||
* @return String | ||
*/ | ||
public String getFrom() { | ||
return from; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_renamed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
{ | ||
"action": "renamed", | ||
"changes": { | ||
"repository": { | ||
"name": { | ||
"from": "react-workshop" | ||
} | ||
} | ||
}, | ||
"repository": { | ||
"id": 360319037, | ||
"node_id": "MDEwOlJlcG9zaXRvcnkzNjAzMTkwMzc=", | ||
"name": "react-workshop-renamed", | ||
"full_name": "EJG-Organization/react-workshop-renamed", | ||
"private": false, | ||
"owner": { | ||
"login": "EJG-Organization", | ||
"id": 168135412, | ||
"node_id": "O_kgDOCgWK9A", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/168135412?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/EJG-Organization", | ||
"html_url": "https://github.com/EJG-Organization", | ||
"followers_url": "https://api.github.com/users/EJG-Organization/followers", | ||
"following_url": "https://api.github.com/users/EJG-Organization/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/EJG-Organization/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/EJG-Organization/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/EJG-Organization/subscriptions", | ||
"organizations_url": "https://api.github.com/users/EJG-Organization/orgs", | ||
"repos_url": "https://api.github.com/users/EJG-Organization/repos", | ||
"events_url": "https://api.github.com/users/EJG-Organization/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/EJG-Organization/received_events", | ||
"type": "Organization", | ||
"site_admin": false | ||
}, | ||
"html_url": "https://github.com/EJG-Organization/react-workshop-renamed", | ||
"description": null, | ||
"fork": true, | ||
"url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed", | ||
"forks_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/forks", | ||
"keys_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/keys{/key_id}", | ||
"collaborators_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/collaborators{/collaborator}", | ||
"teams_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/teams", | ||
"hooks_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/hooks", | ||
"issue_events_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/issues/events{/number}", | ||
"events_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/events", | ||
"assignees_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/assignees{/user}", | ||
"branches_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/branches{/branch}", | ||
"tags_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/tags", | ||
"blobs_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/blobs{/sha}", | ||
"git_tags_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/tags{/sha}", | ||
"git_refs_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/refs{/sha}", | ||
"trees_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/trees{/sha}", | ||
"statuses_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/statuses/{sha}", | ||
"languages_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/languages", | ||
"stargazers_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/stargazers", | ||
"contributors_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/contributors", | ||
"subscribers_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/subscribers", | ||
"subscription_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/subscription", | ||
"commits_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/commits{/sha}", | ||
"git_commits_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/commits{/sha}", | ||
"comments_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/comments{/number}", | ||
"issue_comment_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/issues/comments{/number}", | ||
"contents_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/contents/{+path}", | ||
"compare_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/compare/{base}...{head}", | ||
"merges_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/merges", | ||
"archive_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/{archive_format}{/ref}", | ||
"downloads_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/downloads", | ||
"issues_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/issues{/number}", | ||
"pulls_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/pulls{/number}", | ||
"milestones_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/milestones{/number}", | ||
"notifications_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/notifications{?since,all,participating}", | ||
"labels_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/labels{/name}", | ||
"releases_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/releases{/id}", | ||
"deployments_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/deployments", | ||
"created_at": "2021-04-21T22:09:16Z", | ||
"updated_at": "2024-04-25T20:31:00Z", | ||
"pushed_at": "2021-04-21T03:47:44Z", | ||
"git_url": "git://github.com/EJG-Organization/react-workshop-renamed.git", | ||
"ssh_url": "[email protected]:EJG-Organization/react-workshop-renamed.git", | ||
"clone_url": "https://github.com/EJG-Organization/react-workshop-renamed.git", | ||
"svn_url": "https://github.com/EJG-Organization/react-workshop-renamed", | ||
"homepage": null, | ||
"size": 196, | ||
"stargazers_count": 0, | ||
"watchers_count": 0, | ||
"language": null, | ||
"has_issues": false, | ||
"has_projects": true, | ||
"has_downloads": true, | ||
"has_wiki": true, | ||
"has_pages": false, | ||
"has_discussions": false, | ||
"forks_count": 0, | ||
"mirror_url": null, | ||
"archived": false, | ||
"disabled": false, | ||
"open_issues_count": 0, | ||
"license": null, | ||
"allow_forking": true, | ||
"is_template": false, | ||
"web_commit_signoff_required": false, | ||
"topics": [ | ||
|
||
], | ||
"visibility": "public", | ||
"forks": 0, | ||
"open_issues": 0, | ||
"watchers": 0, | ||
"default_branch": "main", | ||
"custom_properties": { | ||
|
||
} | ||
}, | ||
"organization": { | ||
"login": "EJG-Organization", | ||
"id": 168135412, | ||
"node_id": "O_kgDOCgWK9A", | ||
"url": "https://api.github.com/orgs/EJG-Organization", | ||
"repos_url": "https://api.github.com/orgs/EJG-Organization/repos", | ||
"events_url": "https://api.github.com/orgs/EJG-Organization/events", | ||
"hooks_url": "https://api.github.com/orgs/EJG-Organization/hooks", | ||
"issues_url": "https://api.github.com/orgs/EJG-Organization/issues", | ||
"members_url": "https://api.github.com/orgs/EJG-Organization/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/EJG-Organization/public_members{/member}", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/168135412?v=4", | ||
"description": null | ||
}, | ||
"sender": { | ||
"login": "eleanorgoh", | ||
"id": 66235606, | ||
"node_id": "MDQ6VXNlcjY2MjM1NjA2", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/66235606?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/eleanorgoh", | ||
"html_url": "https://github.com/eleanorgoh", | ||
"followers_url": "https://api.github.com/users/eleanorgoh/followers", | ||
"following_url": "https://api.github.com/users/eleanorgoh/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/eleanorgoh/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/eleanorgoh/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/eleanorgoh/subscriptions", | ||
"organizations_url": "https://api.github.com/users/eleanorgoh/orgs", | ||
"repos_url": "https://api.github.com/users/eleanorgoh/repos", | ||
"events_url": "https://api.github.com/users/eleanorgoh/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/eleanorgoh/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
} | ||
} |
Oops, something went wrong.