Get branch to which a Github Pull Request comment belongs - github

I'm building the Github PR comment to Travis build thing from my previous question (since it does not seem to exist), but I'm running into the problem:
Github sends a webhook call for Issue comments (which is how they call PR comments)
That comment payload has an issue object attached to it.
There is a lot of stuff in the issue but information about what branch the changes are in is not one of them.
I also don't see an obvious way of retrieving the branch.
Am I missing something here?

Turns out I wasn't missing anything, Github answered:
Thanks for sharing your thoughts -- I'll pass them along to the team
working on webhooks but I don't expect any changes here in the near
future. For now, for each pull request that's opened -- you can save
the head and base branch information on your end. Then, once you
receive an issue comment webhook delivery, you will know which pull
request and which branches it is about without needing to call the
API.

Related

Change the target branch of an existing pull request to another fork

I forked a repository A.. say B
I created a pull request from branch B.branch1 TO B.master
The pull request got some review comments.. I resolve them and so on..
I now want to change the base from B.master to A.master(parent repo)
How can I do this in case of an existing PR?
Since I am not seeing the option to change the base branch to another repo..
I know I can create a new pull request but that would lose all the review conversation.
A pull request is an entity that is tied to the repository it was created in. Other repositories (even if forked from the original repository) may have other rules regarding pull requests, code reviews or repository access in general. The developers giving you a code review in fork A might even not be able to do so in fork B.
Therefore you can not move your pull request to another repository.
I suggest you close your current pull request and open a new one. You can link to the old PR and explain the situation so people can still see the code review conversation that was going on in the original PR.

How to block GitHub pull request when Jira ticket is not present

At my previous job a pull request in Github was only allowed to be merged if the new branch, the pull request title, and all of the commits had a Jira ticket number in the title.
I was sure that it was something trivial. However, I cannot figure out how to do it.
Did anyone implement something similar?
You can implement a simple protection using name pattern for the new branch you are creating.
You can read about it here:
managing-a-branch-protection-rule

Accepted merge requests author not shown as contributor

Recently I've started a new open source android project on GitHub (Open Weather App). One person forked the repository and made some changes, then he created a pull request and I accepted it by pressing this green button:
Everything worked just fine, the pull request was merged into master. However, the problem is that he did not appear in the contributors list. It still does say 1 contributor, which is me:
What could be the reason for him not to appear on the list, and how can I solve this issue?
I feel responsibility for him. I even added him to collaborators list, yet he still does not appear as a contributor.
At Contributions that are counted are 3 points listed which must be met by a contributor:
I checked your repo and the pull request and it seems like this point is not met:
The email address used for the commits is associated with your GitHub
account
Are you sure it is not described here?
Why are my contributions not showing up on my profile?

Viewing pull requests that I need to comment on

Does anyone know of a way in GitHub to see pull requests were I am mentioned and either I have not yet commented or commits have been added since I last commented?
If you watch a repository like this, you'll be notified by everything that happens on that particular repo:
New commits will appear on your on-site dashboard and comments on commits/issues/PRs (by the way "PR" stands for "Pull Request) as well as opened/closed/merged PRs and issues will come up both by e-mail and on your dashboard.

Suppress Github references from commit message to PR

I have a branch in which I (automatically) apply some patches from pull requests.
I do so by committing the PRs' diff and have a commit message like this one
PATCHED | Apply patch https://github.com/randombit/botan/pull/386
Now every time I do that in a commit that is hosted on Github, the PR gets referenced.
In my case this does not add any value to the PR itself, as it is referenced multiple times and not part of any discussion. Can I suppress this referencing from my commit message?
This is what happens when I create a bunch of different commits that have a PR url in the commit message:
Here you can verify that totally unrelated commits create references just by commit message parsing:
https://github.com/webmaster128/dummy-github-ref-test
https://github.com/randombit/botan/pull/386
One simple thing you could do is, not write the reference to the PR # in a way that github will parse it as such.
So, instead of
https://github.com/randombit/botan/pull/386
or
#386
you could try writing just
Pull request number 386
The fanciest thing that I could imagine doing is,
https://myserver.com/botan/pull/386
and then setup your server to redirect such queries to your github page... That way, you still get a clickable hyperlink in the commit messages, but you subvert github's referencing. It's a lot more effort than the alternatives though.
Edit: This is the most complete documentation I could find about github references in gfm. Here is some additional info about the parsing they do for 'closing issues via commit messages'. I couldn't find any more detailed documentation.
Now every time I do that in a commit that is hosted on Github, the PR gets referenced.
This is what pull request is all about, any change made to the given branch is added to the PR and any contributor is being notified about it.
You will keep getting notification until you will do one of the following
Close the pull request
Once the pull request is closed it will not track changes made to the given branch
Unsubscribe
Click on unsubscribe option in the pull request
Close the pull request
Close the pull request by accepting or declining it