-
Notifications
You must be signed in to change notification settings - Fork 711
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 #1625 from MarcelHB/issue-1592/create_deploy_key_ro
GHRepository: allows creating deploy keys being read-only
- Loading branch information
Showing
20 changed files
with
882 additions
and
4 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
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
117 changes: 117 additions & 0 deletions
117
...hub/AppTest/wiremock/testAddDeployKey/__files/repos_hub4j-test-org_github-api-test-2.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,117 @@ | ||
{ | ||
"id": 611473997, | ||
"node_id": "R_kgDOJHJaTQ", | ||
"name": "github-api-test", | ||
"full_name": "hub4j-test-org/github-api-test", | ||
"private": false, | ||
"owner": { | ||
"login": "hub4j-test-org", | ||
"id": 238558, | ||
"node_id": "MDQ6VXNlcjIzODU1OA==", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/238558?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/hub4j-test-org", | ||
"html_url": "https://github.com/hub4j-test-org", | ||
"followers_url": "https://api.github.com/users/hub4j-test-org/followers", | ||
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", | ||
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", | ||
"repos_url": "https://api.github.com/users/hub4j-test-org/repos", | ||
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"html_url": "https://github.com/hub4j-test-org/github-api-test", | ||
"description": "A test repository for testing the github-api project: github-api-test", | ||
"fork": false, | ||
"url": "https://api.github.com/repos/hub4j-test-org/github-api-test", | ||
"forks_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/forks", | ||
"keys_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/keys{/key_id}", | ||
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/collaborators{/collaborator}", | ||
"teams_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/teams", | ||
"hooks_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/hooks", | ||
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/issues/events{/number}", | ||
"events_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/events", | ||
"assignees_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/assignees{/user}", | ||
"branches_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/branches{/branch}", | ||
"tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/tags", | ||
"blobs_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/blobs{/sha}", | ||
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/tags{/sha}", | ||
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/refs{/sha}", | ||
"trees_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/trees{/sha}", | ||
"statuses_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/statuses/{sha}", | ||
"languages_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/languages", | ||
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/stargazers", | ||
"contributors_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/contributors", | ||
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/subscribers", | ||
"subscription_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/subscription", | ||
"commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/commits{/sha}", | ||
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/commits{/sha}", | ||
"comments_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/comments{/number}", | ||
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/issues/comments{/number}", | ||
"contents_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/contents/{+path}", | ||
"compare_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/compare/{base}...{head}", | ||
"merges_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/merges", | ||
"archive_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/{archive_format}{/ref}", | ||
"downloads_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/downloads", | ||
"issues_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/issues{/number}", | ||
"pulls_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/pulls{/number}", | ||
"milestones_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/milestones{/number}", | ||
"notifications_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/notifications{?since,all,participating}", | ||
"labels_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/labels{/name}", | ||
"releases_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/releases{/id}", | ||
"deployments_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/deployments", | ||
"created_at": "2023-03-08T22:36:45Z", | ||
"updated_at": "2023-03-08T22:36:45Z", | ||
"pushed_at": "2023-03-08T22:36:45Z", | ||
"git_url": "git://github.com/hub4j-test-org/github-api-test.git", | ||
"ssh_url": "git@github.com:hub4j-test-org/github-api-test.git", | ||
"clone_url": "https://github.com/hub4j-test-org/github-api-test.git", | ||
"svn_url": "https://github.com/hub4j-test-org/github-api-test", | ||
"homepage": "http://github-api.kohsuke.org/", | ||
"size": 0, | ||
"stargazers_count": 0, | ||
"watchers_count": 0, | ||
"language": null, | ||
"has_issues": true, | ||
"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", | ||
"permissions": { | ||
"admin": true, | ||
"maintain": true, | ||
"push": true, | ||
"triage": true, | ||
"pull": true | ||
}, | ||
"security_and_analysis": { | ||
"secret_scanning": { | ||
"status": "disabled" | ||
}, | ||
"secret_scanning_push_protection": { | ||
"status": "disabled" | ||
} | ||
}, | ||
"network_count": 0, | ||
"subscribers_count": 1 | ||
} |
11 changes: 11 additions & 0 deletions
11
...ppTest/wiremock/testAddDeployKey/__files/repos_hub4j-test-org_github-api-test_keys-3.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,11 @@ | ||
{ | ||
"id": 78869617, | ||
"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIATWwMLytklB44O66isWRKOB3Qd7Ysc7q7EyWTmT0bG9", | ||
"url": "https://api.github.com/repos/hub4j-test-org/github-api-test/keys/78869617", | ||
"title": "test", | ||
"verified": true, | ||
"created_at": "2023-03-08T22:36:50Z", | ||
"read_only": false, | ||
"last_used": null, | ||
"added_by": "hub4j-test-org" | ||
} |
13 changes: 13 additions & 0 deletions
13
...ppTest/wiremock/testAddDeployKey/__files/repos_hub4j-test-org_github-api-test_keys-4.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,13 @@ | ||
[ | ||
{ | ||
"id": 78869617, | ||
"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIATWwMLytklB44O66isWRKOB3Qd7Ysc7q7EyWTmT0bG9", | ||
"url": "https://api.github.com/repos/hub4j-test-org/github-api-test/keys/78869617", | ||
"title": "test", | ||
"verified": true, | ||
"created_at": "2023-03-08T22:36:50Z", | ||
"read_only": false, | ||
"last_used": null, | ||
"added_by": "hub4j-test-org" | ||
} | ||
] |
34 changes: 34 additions & 0 deletions
34
src/test/resources/org/kohsuke/github/AppTest/wiremock/testAddDeployKey/__files/user-1.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,34 @@ | ||
{ | ||
"login": "hub4j-test-org", | ||
"id": 7544739, | ||
"node_id": "MDQ6VXNlcjIzODU1OA==", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/hub4j-test-org", | ||
"html_url": "https://github.com/hub4j-test-org", | ||
"followers_url": "https://api.github.com/users/hub4j-test-org/followers", | ||
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", | ||
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", | ||
"repos_url": "https://api.github.com/users/hub4j-test-org/repos", | ||
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", | ||
"type": "User", | ||
"site_admin": false, | ||
"name": "hub4j-test-org", | ||
"company": null, | ||
"blog": "", | ||
"location": "", | ||
"email": null, | ||
"hireable": null, | ||
"bio": "", | ||
"twitter_username": null, | ||
"public_repos": 13, | ||
"public_gists": 4, | ||
"followers": 6, | ||
"following": 1, | ||
"created_at": "2010-04-07T08:30:12Z", | ||
"updated_at": "2022-11-28T20:54:46Z" | ||
} |
49 changes: 49 additions & 0 deletions
49
...ub/AppTest/wiremock/testAddDeployKey/mappings/repos_hub4j-test-org_github-api-test-2.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,49 @@ | ||
{ | ||
"id": "8b7ef826-893b-4288-b625-4492949cd9b1", | ||
"name": "repos_hub4j-test-org_github-api-test", | ||
"request": { | ||
"url": "/repos/hub4j-test-org/github-api-test", | ||
"method": "GET", | ||
"headers": { | ||
"Accept": { | ||
"equalTo": "application/vnd.github.v3+json" | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200, | ||
"bodyFileName": "repos_hub4j-test-org_github-api-test-2.json", | ||
"headers": { | ||
"Server": "GitHub.com", | ||
"Date": "Wed, 08 Mar 2023 22:36:49 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Cache-Control": "private, max-age=60, s-maxage=60", | ||
"Vary": [ | ||
"Accept, Authorization, Cookie, X-GitHub-OTP", | ||
"Accept-Encoding, Accept, X-Requested-With" | ||
], | ||
"ETag": "W/\"9a25876ca00d328a54c1400dffe501009cdcbc3410dd90140b0c33cc19608961\"", | ||
"Last-Modified": "Wed, 08 Mar 2023 22:36:45 GMT", | ||
"github-authentication-token-expiration": "2023-04-07 23:24:34 +0200", | ||
"X-GitHub-Media-Type": "github.v3; format=json", | ||
"x-github-api-version-selected": "2022-11-28", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4903", | ||
"X-RateLimit-Reset": "1678317208", | ||
"X-RateLimit-Used": "97", | ||
"X-RateLimit-Resource": "core", | ||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", | ||
"Access-Control-Allow-Origin": "*", | ||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", | ||
"X-Frame-Options": "deny", | ||
"X-Content-Type-Options": "nosniff", | ||
"X-XSS-Protection": "0", | ||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", | ||
"Content-Security-Policy": "default-src 'none'", | ||
"X-GitHub-Request-Id": "E5D8:ACE5:B4A8F2D:B741C36:64090E01" | ||
} | ||
}, | ||
"uuid": "8b7ef826-893b-4288-b625-4492949cd9b1", | ||
"persistent": true, | ||
"insertionIndex": 2 | ||
} |
56 changes: 56 additions & 0 deletions
56
...pTest/wiremock/testAddDeployKey/mappings/repos_hub4j-test-org_github-api-test_keys-3.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,56 @@ | ||
{ | ||
"id": "f648e6ad-c2ec-42b2-bc75-017ac64e67d9", | ||
"name": "repos_hub4j-test-org_github-api-test_keys", | ||
"request": { | ||
"url": "/repos/hub4j-test-org/github-api-test/keys", | ||
"method": "POST", | ||
"headers": { | ||
"Accept": { | ||
"equalTo": "application/vnd.github.v3+json" | ||
} | ||
}, | ||
"bodyPatterns": [ | ||
{ | ||
"equalToJson": "{\"read_only\":false,\"title\":\"test\",\"key\":\"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIATWwMLytklB44O66isWRKOB3Qd7Ysc7q7EyWTmT0bG9 test@example.com\"}", | ||
"ignoreArrayOrder": true, | ||
"ignoreExtraElements": false | ||
} | ||
] | ||
}, | ||
"response": { | ||
"status": 201, | ||
"bodyFileName": "repos_hub4j-test-org_github-api-test_keys-3.json", | ||
"headers": { | ||
"Server": "GitHub.com", | ||
"Date": "Wed, 08 Mar 2023 22:36:50 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Cache-Control": "private, max-age=60, s-maxage=60", | ||
"Vary": [ | ||
"Accept, Authorization, Cookie, X-GitHub-OTP", | ||
"Accept-Encoding, Accept, X-Requested-With" | ||
], | ||
"ETag": "\"0a4e82c98d34824d431a19b779f7fcc35e1a3c1142ff9c1a7132d8840630f8a6\"", | ||
"github-authentication-token-expiration": "2023-04-07 23:24:34 +0200", | ||
"X-GitHub-Media-Type": "github.v3; format=json", | ||
"x-github-api-version-selected": "2022-11-28", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4902", | ||
"X-RateLimit-Reset": "1678317208", | ||
"X-RateLimit-Used": "98", | ||
"X-RateLimit-Resource": "core", | ||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", | ||
"Access-Control-Allow-Origin": "*", | ||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", | ||
"X-Frame-Options": "deny", | ||
"X-Content-Type-Options": "nosniff", | ||
"X-XSS-Protection": "0", | ||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", | ||
"Content-Security-Policy": "default-src 'none'", | ||
"X-GitHub-Request-Id": "E5DE:A9BF:A40D94B:A69E360:64090E01", | ||
"Location": "https://api.github.com/repos/hub4j-test-org/github-api-test/keys/78869617" | ||
} | ||
}, | ||
"uuid": "f648e6ad-c2ec-42b2-bc75-017ac64e67d9", | ||
"persistent": true, | ||
"insertionIndex": 3 | ||
} |
Oops, something went wrong.