How to get pull requests references for an issue - github

Given a GitHub issue, is there any way to get the pull requests that reference to that issue via API?
That info is showed in the GitHub html page but I can't see nothing in the API documentation.
Is it really possible?

is there any way to get the pull requests that reference to that issue via API
Not directly.
Even the reverse is not possible, as a pull request has a link 'issue' pointing to... itself.
But as mentioned in the issue API:
In the past, pull requests and issues were more closely aligned than they are now.
As far as the API is concerned, every pull request is an issue, but not every issue is a pull request.
This endpoint may also return pull requests in the response. If an issue is a pull request, the object will include a pull_request key.
So you would need to list the comments of a pull request (using the Issue Comments API since comments on PR are done with it), and parse said comment to find a reference to an issue.

Related

How to assign a pull request using the REST API?

I'm creating a GitHub pull request using the appropriate REST API. Specifying a single assignee or an assignees (using either the user login or GitHub's internal id) has no effect. The pull request will be created, but without an assignee set. There also seems to be no other endpoint to explicitly assign a pull request to a user. Now I'm wondering whether it's possible at all to set the assignee of a pull request using the REST API?
Every pull request is an issue, but not every issue is a pull request.
For this reason, "shared" actions for both features, like manipulating
assignees, labels and milestones, are provided within the Issues API.
From PR Doc
So, you can use Add assignees to an issue API to set an assignee(s) to a pull request After PR is created. You need to know its number, which is in the JSON body of Create Pull Request's response.
/repos/{owner}/{repo}/issues/{issue_number}/assignees
where issue_number is same as pr_number

How does Jira confluence software talk to Github server?

So, As github is deprecating authorization through access_token query param, we were sent a mail from github that a call has been made with access_token in query param and were asked to update things to include authorization info in request headers.
We are suspecting that the api call is made from Jira confluence app from the github integration that was done by admin which we don't have control over.
So, just trying to debug things here. Does anyone know how Jira confluence internally communicates with Github servers using access_token to update pull requests and commits etc in Jira tickets?
If this is not the correct domain for this please move it to the right one.
It is very possibly the Github/Jira integration. This bug ticket was resolved in August but based on the comments there it's not completely fixed or released.
This issue has some back-and-forth but this comment clears things up: it looks like GitHub recommends uninstalling the old Jira integration and using the one GitHub maintains instead.

If I have a GitHub issue number for a pull request, is that the same as the pull request number?

When I create a pull request immediately after an issue, the pull request number is often 1 more than the issue number, which suggests that they share the same counter. As well, the Create an issue comment API seems to be the primary way for commenting back to the main discussion in a pull request, and API requests an issue_number. However, nothing on GitHub officially states that the issue number is equal to the pull request number.
Is there any official documentation or comment that verifies if an issue number for a pull request is equal to its pull request number?
Issues, pull requests, and (if enabled) discussions are all numbered from the same pool. If you're using the API, using the pull request number for shared actions is the right thing to do:
Every pull request is an issue, but not every issue is a pull request. For this reason, "shared" actions for both features, like manipulating assignees, labels and milestones, are provided within the Issues API.
Yes, they share the same numbers.
You could also see when changing the number in the url (pull request url or issue url), it will redirect to the correct type (so issue or pull request)
It's some what documented here: https://docs.github.com/en/github/writing-on-github/autolinked-references-and-urls#issues-and-pull-requests
Issue or pull request URL
...
Short link
#26

How do I check if an issue is a pull request?

I'm building a Github App. I receive an issue_comment webhook. Is there any quick way for me to know whether the comment was made in a pull request of not?
From the Issues API docs...
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key.
You should be able to look at comment["issue"]["pull_request"].

Get Pipeline Value of GitHub Issues?

I use ZenHub to manage my Issues on GitHub.
When I go to the detail of an issue I can see the property "pipeline" in GitHub which is exactly the column where the Issue is saved.
Now I want to get the pipeline information out of my issues using the API of GitHub. But none of the Issue-Methods
GET /repos/:owner/:repo/issues or GET /repos/:owner/:repo/issues/:number seem to have any information about the pipeline. Is it hidden anywhere else?
Pipeline is purely a ZenHub feature.
As such, it is not exposed in the Github API Issues (or in any other GitHub API)
A ZenHub public API is in the making (issue 172).
Update: The API is available: ZenHub API
With the Github API v4, you can query the combinedContexts of a commit to retrieve a list of status contexts and check runs for the commit triggering your pipelines.