Is it possible through the Github API to tell if a commit is a merge commit? And which branch it was merged from?
I am trying to look at all the files changed when comparing two commits on a branch, but I want to ignore any changes done by merge commits from the branch that it's branched from. Any branches that have branched off the branch will not have their merge commits ignored.
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/commits
You can use this API to fetch all the commits. After fetching all the commits the response would look like this as per GitHub's API documentation.
[
{
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"node_id": "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==",
"html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments",
"commit": {
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"author": {
"name": "Monalisa Octocat",
"email": "support#github.com",
"date": "2011-04-14T16:00:49Z"
},
"committer": {
"name": "Monalisa Octocat",
"email": "support#github.com",
"date": "2011-04-14T16:00:49Z"
},
"message": "Fix all the bugs",
"tree": {
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
},
"comment_count": 0,
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null
}
},
"author": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"committer": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"parents": [
{
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
}
]
}
]
In the above payload, for each item in the array, if you have multiple lines in the "parents" key, then it means it is a merge commit. The above payload example has only one line in the "parents" array, so it is not a merge commit.
To find out which branch it was merged from, I believe there is currently no solution using the Github API.
Related
I'm using GitLab 15.3.1 version and I'd like to obtain, using GitLab API, the label added date for a project issue.
This information is available from GitLab web browser interface as shown below
Is there any way to obtain that "11/10/2022 2.44pm" via API for that issue?
Thank you in advance
You can get Label events for a single Issue with the List project issue label events API.
Here's an example using this Issue:
curl --header 'Authorization: Bearer xxxTOKENxxx' https://gitlab.com/api/v4/projects/278964/issues/378378/resource_label_events | jq '.'
Response:
[
{
"id": 192875035,
"user": {
"id": 9671578,
"username": "rzwambag",
"name": "Roy Zwambag",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/9671578/avatar.png",
"web_url": "https://gitlab.com/rzwambag"
},
"created_at": "2022-10-19T08:51:15.420Z",
"resource_type": "Issue",
"resource_id": 117155410,
"label": {
"id": 17963221,
"name": "application performance::active",
"description": " Any issues that group::application performance has scheduled and is working on. They are in the build phase of the product development flow.",
"description_html": " Any issues that group::application performance has scheduled and is working on. They are in the build phase of the product development flow.",
"text_color": "#FFFFFF",
"color": "#69D100"
},
"action": "add"
},
{
"id": 192875036,
"user": {
"id": 9671578,
"username": "rzwambag",
"name": "Roy Zwambag",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/9671578/avatar.png",
"web_url": "https://gitlab.com/rzwambag"
},
"created_at": "2022-10-19T08:51:15.420Z",
"resource_type": "Issue",
"resource_id": 117155410,
"label": {
"id": 10690783,
"name": "group::application performance",
"description": "Issues belonging to the Application Performance group (formerly known as Memory) of the Enablement stage of the DevOps lifecycle. See https://about.gitlab.com/handbook/product/categories/#application-performance-group",
"description_html": "Issues belonging to the Application Performance group (formerly known as Memory) of the Enablement stage of the DevOps lifecycle. See https://about.gitlab.com/handbook/product/categories/#application-performance-group",
"text_color": "#333333",
"color": "#A8D695"
},
"action": "add"
},
{
"id": 192875037,
"user": {
"id": 9671578,
"username": "rzwambag",
"name": "Roy Zwambag",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/9671578/avatar.png",
"web_url": "https://gitlab.com/rzwambag"
},
"created_at": "2022-10-19T08:51:15.420Z",
"resource_type": "Issue",
"resource_id": 117155410,
"label": {
"id": 15119514,
"name": "type::maintenance",
"description": "Upkeeping efforts and catch-up corrective improvements that are not Feature nor Bugs. Read more at https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification",
"description_html": "Upkeeping efforts and catch-up corrective improvements that are not Feature nor Bugs. Read more at https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification",
"text_color": "#FFFFFF",
"color": "#330066"
},
"action": "add"
},
{
"id": 192875043,
"user": {
"id": 1786152,
"username": "gitlab-bot",
"name": "🤖 GitLab Bot 🤖",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/1786152/avatar.png",
"web_url": "https://gitlab.com/gitlab-bot"
},
"created_at": "2022-10-19T08:51:16.579Z",
"resource_type": "Issue",
"resource_id": 117155410,
"label": {
"id": 25316145,
"name": "devops::data_stores",
"description": "Issues for the Systems stage of the DevOps lifecycle (Memory, Database, Global Search, Sharding)",
"description_html": "Issues for the Systems stage of the DevOps lifecycle (Memory, Database, Global Search, Sharding)",
"text_color": "#FFFFFF",
"color": "#E44D2A"
},
"action": "add"
},
{
"id": 192875044,
"user": {
"id": 1786152,
"username": "gitlab-bot",
"name": "🤖 GitLab Bot 🤖",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/1786152/avatar.png",
"web_url": "https://gitlab.com/gitlab-bot"
},
"created_at": "2022-10-19T08:51:16.579Z",
"resource_type": "Issue",
"resource_id": 117155410,
"label": {
"id": 14918396,
"name": "section::enablement",
"description": "Issues related to the Enablement section",
"description_html": "Issues related to the Enablement section",
"text_color": "#FFFFFF",
"color": "#F0AD4E"
},
"action": "add"
},
{
"id": 192875250,
"user": {
"id": 9671578,
"username": "rzwambag",
"name": "Roy Zwambag",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/9671578/avatar.png",
"web_url": "https://gitlab.com/rzwambag"
},
"created_at": "2022-10-19T08:52:13.714Z",
"resource_type": "Issue",
"resource_id": 117155410,
"label": {
"id": 2526320,
"name": "workflow::in dev",
"description": "Issues that are actively being worked on by a developer",
"description_html": "Issues that are actively being worked on by a developer",
"text_color": "#FFFFFF",
"color": "#428BCA"
},
"action": "add"
},
{
"id": 192875320,
"user": {
"id": 9671578,
"username": "rzwambag",
"name": "Roy Zwambag",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/9671578/avatar.png",
"web_url": "https://gitlab.com/rzwambag"
},
"created_at": "2022-10-19T08:52:28.908Z",
"resource_type": "Issue",
"resource_id": 117155410,
"label": {
"id": 2526320,
"name": "workflow::in dev",
"description": "Issues that are actively being worked on by a developer",
"description_html": "Issues that are actively being worked on by a developer",
"text_color": "#FFFFFF",
"color": "#428BCA"
},
"action": "remove"
}
]
I was searching through the api docs. It appear the same api call is being used for getting details except content when a dir is provided and content when a single file is given.
https://docs.github.com/en/rest/reference/repos#get-repository-content--code-samples
In the case of Response if content is a file
"type": "file",
"encoding": "base64",
"size": 5362,
"name": "README.md",
"path": "README.md",
"content": "encoded content ...",
"sha": "3d21ec53a331a6f037a91c368710b99387d012c1",
"url": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md",
"git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
"html_url": "https://github.com/octokit/octokit.rb/blob/master/README.md",
"download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/README.md",
"_links": {
"git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
"self": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md",
"html": "https://github.com/octokit/octokit.rb/blob/master/README.md"
}
}
In case of Response if content is a directory
{
"type": "file",
"size": 625,
"name": "octokit.rb",
"path": "lib/octokit.rb",
"sha": "fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
"url": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit.rb",
"git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
"html_url": "https://github.com/octokit/octokit.rb/blob/master/lib/octokit.rb",
"download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/lib/octokit.rb",
"_links": {
"self": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit.rb",
"git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
"html": "https://github.com/octokit/octokit.rb/blob/master/lib/octokit.rb"
}
},
{
"type": "dir",
"size": 0,
"name": "octokit",
"path": "lib/octokit",
"sha": "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
"url": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit",
"git_url": "https://api.github.com/repos/octokit/octokit.rb/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
"html_url": "https://github.com/octokit/octokit.rb/tree/master/lib/octokit",
"download_url": null,
"_links": {
"self": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit",
"git": "https://api.github.com/repos/octokit/octokit.rb/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
"html": "https://github.com/octokit/octokit.rb/tree/master/lib/octokit"
}
}
]
How can I get the content too as an output field for all the files in a directory through a single api call. Is there any way to do so?
i am trying to get filename from github gist API, the below output which i get while calling the gist api.But the problem is how do i get the filename from the output. because filename is under files, and i want to display filename. So how do i do that. I am new to API so only able to display url, id, etc.
{
"url": "https://api.github.com/gists/41da54b03986886e1a4e57c8cdb38dc2",
"forks_url": "https://api.github.com/gists/41da54b03986886e1a4e57c8cdb38dc2/forks",
"commits_url": "https://api.github.com/gists/41da54b03986886e1a4e57c8cdb38dc2/commits",
"id": "41da54b03986886e1a4e57c8cdb38dc2",
"node_id": "MDQ6R2lzdDQxZGE1NGIwMzk4Njg4NmUxYTRlNTdjOGNkYjM4ZGMy",
"git_pull_url": "https://gist.github.com/41da54b03986886e1a4e57c8cdb38dc2.git",
"git_push_url": "https://gist.github.com/41da54b03986886e1a4e57c8cdb38dc2.git",
"html_url": "https://gist.github.com/41da54b03986886e1a4e57c8cdb38dc2",
"files": {
"telegram-white.svg": {
"filename": "telegram-white.svg",
"type": "image/svg+xml",
"language": "SVG",
"raw_url": "https://gist.githubusercontent.com/cmschandan/41da54b03986886e1a4e57c8cdb38dc2/raw/16b1aac41526997d87400f33ad9912d511faf7a4/telegram-white.svg",
"size": 1266
}
},
"public": true,
"created_at": "2020-12-11T12:58:59Z",
"updated_at": "2020-12-11T12:59:46Z",
"description": "",
"comments": 0,
"user": null,
"comments_url": "https://api.github.com/gists/41da54b03986886e1a4e57c8cdb38dc2/comments",
"owner": {
"login": "cmschandan",
"id": 21227329,
"node_id": "MDQ6VXNlcjIxMjI3MzI5",
"avatar_url": "https://avatars.githubusercontent.com/u/21227329?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/cmschandan",
"html_url": "https://github.com/cmschandan",
"followers_url": "https://api.github.com/users/cmschandan/followers",
"following_url": "https://api.github.com/users/cmschandan/following{/other_user}",
"gists_url": "https://api.github.com/users/cmschandan/gists{/gist_id}",
"starred_url": "https://api.github.com/users/cmschandan/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/cmschandan/subscriptions",
"organizations_url": "https://api.github.com/users/cmschandan/orgs",
"repos_url": "https://api.github.com/users/cmschandan/repos",
"events_url": "https://api.github.com/users/cmschandan/events{/privacy}",
"received_events_url": "https://api.github.com/users/cmschandan/received_events",
"type": "User",
"site_admin": false
},
"truncated": false
},
If you are using JavaScript then you can do something like this:
// `getGitHubGist` is a function that I assume you already
// implemented which fetches your desired gist.
const gist = await getGitHubGist();
// Get an array of filename strings
const filenames = Object.keys(gist.files);
// Get an array of all the file details
const files = Object.values(gist.files);
I want to count the downloads for a release on a public repo. The documentation at https://docs.github.com/en/free-pro-team#latest/rest/reference/repos#list-release-assets
indicates that the assets request below should have a variable "download_count:".
This is what I get for my small public test repo in a newly created test organization with 2 known downloads for the release v1.0:
curl https://api.github.com/repos/test10010000/countMyReleases/releases/tags/v1.0
The response is:
"url": "https://api.github.com/repos/test10010000/countMyReleases/releases/34859773",
"assets_url": "https://api.github.com/repos/test10010000/countMyReleases/releases/34859773/assets",
"upload_url": "https://uploads.github.com/repos/test10010000/countMyReleases/releases/34859773/assets{?name,label}",
"html_url": "https://github.com/test10010000/countMyReleases/releases/tag/v1.0",
"id": 34859773,
"author": {
"login": "breckbaldwin",
"id": 6377185,
"node_id": "MDQ6VXNlcjYzNzcxODU=",
"avatar_url": "https://avatars2.githubusercontent.com/u/6377185?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/breckbaldwin",
"html_url": "https://github.com/breckbaldwin",
"followers_url": "https://api.github.com/users/breckbaldwin/followers",
"following_url": "https://api.github.com/users/breckbaldwin/following{/other_user}",
"gists_url": "https://api.github.com/users/breckbaldwin/gists{/gist_id}",
"starred_url": "https://api.github.com/users/breckbaldwin/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/breckbaldwin/subscriptions",
"organizations_url": "https://api.github.com/users/breckbaldwin/orgs",
"repos_url": "https://api.github.com/users/breckbaldwin/repos",
"events_url": "https://api.github.com/users/breckbaldwin/events{/privacy}",
"received_events_url": "https://api.github.com/users/breckbaldwin/received_events",
"type": "User",
"site_admin": false
},
"node_id": "MDc6UmVsZWFzZTM0ODU5Nzcz",
"tag_name": "v1.0",
"target_commitish": "main",
"name": "Test Count Downloads",
"draft": false,
"prerelease": false,
"created_at": "2020-12-04T23:28:39Z",
"published_at": "2020-12-04T23:29:18Z",
"assets": [
],
"tarball_url": "https://api.github.com/repos/test10010000/countMyReleases/tarball/v1.0",
"zipball_url": "https://api.github.com/repos/test10010000/countMyReleases/zipball/v1.0",
"body": ""
}
So I am getting the data on the release, but note that the assets list is empty. I run the explicit request for the assets as indicated in the documentation (this url is also supplied in the return data above):
curl https://api.github.com/repos/test10010000/countMyReleases/releases/34859773/assets
This returns an empty list:
[
]
Adding in my authorization token and looking at return headers with -i as follows:
curl -i -u breckbaldwin:$github_token https://api.github.com/repos/test10010000/countMyReleases/releases/34859773/assets
I get:
HTTP/1.1 200 OK
Server: GitHub.com
Date: Fri, 04 Dec 2020 23:44:15 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 5
Status: 200 OK
Cache-Control: private, max-age=60, s-maxage=60
Vary: Accept, Authorization, Cookie, X-GitHub-OTP
ETag: "7ac3b1740ea68a78ed14bc8d160dae63ad1710fffb20a10910ae02fff4661e1d"
X-OAuth-Scopes: admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages
X-Accepted-OAuth-Scopes: repo
X-GitHub-Media-Type: github.v3; format=json
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4990
X-RateLimit-Reset: 1607125659
X-RateLimit-Used: 10
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, 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: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
Vary: Accept-Encoding, Accept, X-Requested-With
X-GitHub-Request-Id: AE6A:5AF5:108649D:1BE42F1:5FCAC9CF
[
]
Still no "download_count:". I am expecting an assets list that looks like (from the documentation for a different repo):
[
{
"url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
"browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip",
"id": 1,
"node_id": "MDEyOlJlbGVhc2VBc3NldDE=",
"name": "example.zip",
"label": "short description",
"state": "uploaded",
"content_type": "application/zip",
"size": 1024,
"download_count": 42,
"created_at": "2013-02-27T19:35:32Z",
"updated_at": "2013-02-27T19:35:32Z",
"uploader": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
}
]
Note the "download_count": 42, which is the variable I am looking for.
Any help appreciated.
thanks
Breck
Ok, so I contacted github tech support and they were very quick and helpful.
The automatically generated tarballs/zipballs when you do a release are NOT tracked for number of downloads period even though they are listed as an asset on the website. They are apparently generated on the fly.
You can add a binary file to your release by generating the release, navigating to it and selecting the 'Edit Release' button on the top right. Scroll down to 'Attach binaries...' and add a file.
Now the asset is going to be tracked, so the old failed query:
curl https://api.github.com/repos/test10010000/countMyReleases/releases/tags/v1.0
produces:
curl https://api.github.com/repos/test10010000/countMyReleases/releases/tags/v1.0
{
"url": "https://api.github.com/repos/test10010000/countMyReleases/releases/34859773",
"assets_url": "https://api.github.com/repos/test10010000/countMyReleases/releases/34859773/assets",
"upload_url": "https://uploads.github.com/repos/test10010000/countMyReleases/releases/34859773/assets{?name,label}",
"html_url": "https://github.com/test10010000/countMyReleases/releases/tag/v1.0",
"id": 34859773,
"author": {
"login": "breckbaldwin",
"id": 6377185,
"node_id": "MDQ6VXNlcjYzNzcxODU=",
"avatar_url": "https://avatars2.githubusercontent.com/u/6377185?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/breckbaldwin",
"html_url": "https://github.com/breckbaldwin",
"followers_url": "https://api.github.com/users/breckbaldwin/followers",
"following_url": "https://api.github.com/users/breckbaldwin/following{/other_user}",
"gists_url": "https://api.github.com/users/breckbaldwin/gists{/gist_id}",
"starred_url": "https://api.github.com/users/breckbaldwin/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/breckbaldwin/subscriptions",
"organizations_url": "https://api.github.com/users/breckbaldwin/orgs",
"repos_url": "https://api.github.com/users/breckbaldwin/repos",
"events_url": "https://api.github.com/users/breckbaldwin/events{/privacy}",
"received_events_url": "https://api.github.com/users/breckbaldwin/received_events",
"type": "User",
"site_admin": false
},
"node_id": "MDc6UmVsZWFzZTM0ODU5Nzcz",
"tag_name": "v1.0",
"target_commitish": "main",
"name": "Test Count Downloads",
"draft": false,
"prerelease": false,
"created_at": "2020-12-04T23:28:39Z",
"published_at": "2020-12-04T23:29:18Z",
"assets": [
{
"url": "https://api.github.com/repos/test10010000/countMyReleases/releases/assets/29251257",
"id": 29251257,
"node_id": "MDEyOlJlbGVhc2VBc3NldDI5MjUxMjU3",
"name": "docs.txt.gz",
"label": null,
"uploader": {
"login": "breckbaldwin",
"id": 6377185,
"node_id": "MDQ6VXNlcjYzNzcxODU=",
"avatar_url": "https://avatars2.githubusercontent.com/u/6377185?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/breckbaldwin",
"html_url": "https://github.com/breckbaldwin",
"followers_url": "https://api.github.com/users/breckbaldwin/followers",
"following_url": "https://api.github.com/users/breckbaldwin/following{/other_user}",
"gists_url": "https://api.github.com/users/breckbaldwin/gists{/gist_id}",
"starred_url": "https://api.github.com/users/breckbaldwin/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/breckbaldwin/subscriptions",
"organizations_url": "https://api.github.com/users/breckbaldwin/orgs",
"repos_url": "https://api.github.com/users/breckbaldwin/repos",
"events_url": "https://api.github.com/users/breckbaldwin/events{/privacy}",
"received_events_url": "https://api.github.com/users/breckbaldwin/received_events",
"type": "User",
"site_admin": false
},
"content_type": "application/x-gzip",
"state": "uploaded",
"size": 56,
"download_count": 2,
"created_at": "2020-12-07T13:48:49Z",
"updated_at": "2020-12-07T13:48:50Z",
"browser_download_url": "https://github.com/test10010000/countMyReleases/releases/download/v1.0/docs.txt.gz"
},
{
"url": "https://api.github.com/repos/test10010000/countMyReleases/releases/assets/29252040",
"id": 29252040,
"node_id": "MDEyOlJlbGVhc2VBc3NldDI5MjUyMDQw",
"name": "Figure.1.pdf",
"label": null,
"uploader": {
"login": "breckbaldwin",
"id": 6377185,
"node_id": "MDQ6VXNlcjYzNzcxODU=",
"avatar_url": "https://avatars2.githubusercontent.com/u/6377185?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/breckbaldwin",
"html_url": "https://github.com/breckbaldwin",
"followers_url": "https://api.github.com/users/breckbaldwin/followers",
"following_url": "https://api.github.com/users/breckbaldwin/following{/other_user}",
"gists_url": "https://api.github.com/users/breckbaldwin/gists{/gist_id}",
"starred_url": "https://api.github.com/users/breckbaldwin/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/breckbaldwin/subscriptions",
"organizations_url": "https://api.github.com/users/breckbaldwin/orgs",
"repos_url": "https://api.github.com/users/breckbaldwin/repos",
"events_url": "https://api.github.com/users/breckbaldwin/events{/privacy}",
"received_events_url": "https://api.github.com/users/breckbaldwin/received_events",
"type": "User",
"site_admin": false
},
"content_type": "application/pdf",
"state": "uploaded",
"size": 223221,
"download_count": 1,
"created_at": "2020-12-07T14:08:23Z",
"updated_at": "2020-12-07T14:08:23Z",
"browser_download_url": "https://github.com/test10010000/countMyReleases/releases/download/v1.0/Figure.1.pdf"
}
],
"tarball_url": "https://api.github.com/repos/test10010000/countMyReleases/tarball/v1.0",
"zipball_url": "https://api.github.com/repos/test10010000/countMyReleases/zipball/v1.0",
"body": ""
}
I have both a gzip and pdf in there.
I leave it as an exercise for the reader how to hack this capability into something useful.
Breck
I'm currently using GitHub as a scm. I'm currently building a tool around it but came across some issues. Is there any way to check the pull request assignees and who approved the pull request?
In bitbucket it is really easy to do so, but using GitHub I do not see where to do it :/
You can get a pull request's assignee by using our Issues API:
https://developer.github.com/v3/issues
Specifically, this endpoint:
https://developer.github.com/v3/issues/#get-a-single-issue
Since the Multiple Assignees API is still in preview mode, you will need to explicitly pass this custom media type in the Accept Header:
application/vnd.github.cerberus-preview+json
Omitting this header from the request will not show the multiple assignees for an Issue or Pull Request.
curl https://api.github.com/repos/angular/angular/issues/9355 \
-H "Accept: application/vnd.github.cerberus-preview+json" \
The payload should look something like this, including both assignees
{
"url": "https://api.github.com/repos/angular/angular/issues/9355",
"repository_url": "https://api.github.com/repos/angular/angular",
"labels_url": "https://api.github.com/repos/angular/angular/issues/9355/labels{/name}",
"comments_url": "https://api.github.com/repos/angular/angular/issues/9355/comments",
"events_url": "https://api.github.com/repos/angular/angular/issues/9355/events",
"html_url": "https://github.com/angular/angular/pull/9355",
"id": 161102291,
"number": 9355,
"title": "fix(HTTP/XhrBackend): correctly set the status code on errors",
"user": {
"login": "vicb",
"id": 248818,
"avatar_url": "https://avatars.githubusercontent.com/u/248818?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/vicb",
"html_url": "https://github.com/vicb",
"followers_url": "https://api.github.com/users/vicb/followers",
"following_url": "https://api.github.com/users/vicb/following{/other_user}",
"gists_url": "https://api.github.com/users/vicb/gists{/gist_id}",
"starred_url": "https://api.github.com/users/vicb/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/vicb/subscriptions",
"organizations_url": "https://api.github.com/users/vicb/orgs",
"repos_url": "https://api.github.com/users/vicb/repos",
"events_url": "https://api.github.com/users/vicb/events{/privacy}",
"received_events_url": "https://api.github.com/users/vicb/received_events",
"type": "User",
"site_admin": false
},
"labels": [
{
"url": "https://api.github.com/repos/angular/angular/labels/cla:%20yes",
"name": "cla: yes",
"color": "009800"
},
{
"url": "https://api.github.com/repos/angular/angular/labels/comp:%20http",
"name": "comp: http",
"color": "c7def8"
},
{
"url": "https://api.github.com/repos/angular/angular/labels/pr_action:%20review",
"name": "pr_action: review",
"color": "fbca04"
},
{
"url": "https://api.github.com/repos/angular/angular/labels/type:%20bug",
"name": "type: bug",
"color": "EEEEEE"
}
],
"state": "open",
"locked": false,
"assignee": {
"login": "jeffbcross",
"id": 463703,
"avatar_url": "https://avatars.githubusercontent.com/u/463703?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/jeffbcross",
"html_url": "https://github.com/jeffbcross",
"followers_url": "https://api.github.com/users/jeffbcross/followers",
"following_url": "https://api.github.com/users/jeffbcross/following{/other_user}",
"gists_url": "https://api.github.com/users/jeffbcross/gists{/gist_id}",
"starred_url": "https://api.github.com/users/jeffbcross/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jeffbcross/subscriptions",
"organizations_url": "https://api.github.com/users/jeffbcross/orgs",
"repos_url": "https://api.github.com/users/jeffbcross/repos",
"events_url": "https://api.github.com/users/jeffbcross/events{/privacy}",
"received_events_url": "https://api.github.com/users/jeffbcross/received_events",
"type": "User",
"site_admin": false
},
"milestone": {
"url": "https://api.github.com/repos/angular/angular/milestones/62",
"html_url": "https://github.com/angular/angular/milestones/2.0.0-rc.3",
"labels_url": "https://api.github.com/repos/angular/angular/milestones/62/labels",
"id": 1831054,
"number": 62,
"title": "2.0.0-rc.3",
"description": "",
"creator": {
"login": "IgorMinar",
"id": 216296,
"avatar_url": "https://avatars.githubusercontent.com/u/216296?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/IgorMinar",
"html_url": "https://github.com/IgorMinar",
"followers_url": "https://api.github.com/users/IgorMinar/followers",
"following_url": "https://api.github.com/users/IgorMinar/following{/other_user}",
"gists_url": "https://api.github.com/users/IgorMinar/gists{/gist_id}",
"starred_url": "https://api.github.com/users/IgorMinar/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/IgorMinar/subscriptions",
"organizations_url": "https://api.github.com/users/IgorMinar/orgs",
"repos_url": "https://api.github.com/users/IgorMinar/repos",
"events_url": "https://api.github.com/users/IgorMinar/events{/privacy}",
"received_events_url": "https://api.github.com/users/IgorMinar/received_events",
"type": "User",
"site_admin": false
},
"open_issues": 25,
"closed_issues": 14,
"state": "open",
"created_at": "2016-06-15T23:19:22Z",
"updated_at": "2016-06-20T17:55:29Z",
"due_on": null,
"closed_at": null
},
"comments": 0,
"created_at": "2016-06-20T01:21:21Z",
"updated_at": "2016-06-20T01:21:22Z",
"closed_at": null,
"pull_request": {
"url": "https://api.github.com/repos/angular/angular/pulls/9355",
"html_url": "https://github.com/angular/angular/pull/9355",
"diff_url": "https://github.com/angular/angular/pull/9355.diff",
"patch_url": "https://github.com/angular/angular/pull/9355.patch"
},
"body": "fixes #9329\r\nfixes angular/http#54\r\n\r\n#robwormald #jeffbcross could one of you please review ? Thanks",
"closed_by": null,
"assignees": [
{
"login": "jeffbcross",
"id": 463703,
"avatar_url": "https://avatars.githubusercontent.com/u/463703?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/jeffbcross",
"html_url": "https://github.com/jeffbcross",
"followers_url": "https://api.github.com/users/jeffbcross/followers",
"following_url": "https://api.github.com/users/jeffbcross/following{/other_user}",
"gists_url": "https://api.github.com/users/jeffbcross/gists{/gist_id}",
"starred_url": "https://api.github.com/users/jeffbcross/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jeffbcross/subscriptions",
"organizations_url": "https://api.github.com/users/jeffbcross/orgs",
"repos_url": "https://api.github.com/users/jeffbcross/repos",
"events_url": "https://api.github.com/users/jeffbcross/events{/privacy}",
"received_events_url": "https://api.github.com/users/jeffbcross/received_events",
"type": "User",
"site_admin": false
},
{
"login": "robwormald",
"id": 534930,
"avatar_url": "https://avatars.githubusercontent.com/u/534930?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/robwormald",
"html_url": "https://github.com/robwormald",
"followers_url": "https://api.github.com/users/robwormald/followers",
"following_url": "https://api.github.com/users/robwormald/following{/other_user}",
"gists_url": "https://api.github.com/users/robwormald/gists{/gist_id}",
"starred_url": "https://api.github.com/users/robwormald/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/robwormald/subscriptions",
"organizations_url": "https://api.github.com/users/robwormald/orgs",
"repos_url": "https://api.github.com/users/robwormald/repos",
"events_url": "https://api.github.com/users/robwormald/events{/privacy}",
"received_events_url": "https://api.github.com/users/robwormald/received_events",
"type": "User",
"site_admin": false
}
]
}