You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to what was discussed by @vanniktech in #1105 but not exactly the same, because I have no interest in a "hot key" - just a button.
Summary:
If you enable branch protection for a repository and select "Require branches to be up-to-date before merging", then you get an Update Branch button whenever the branch goes stale.
However it would be convenient to have this for all my PRs, including ones in repositories that don't enforce this branch protection.
This button would merge the default branch in the PR branch with a merge commit if there are no conflicts.
It might be a little tricky to work out who has write access to that branch when it's coming from a fork. In theory this feature/button could initially work for branches within the same repository only though.
Need some help from other developers? Add your repositories on IssueHunt to raise funds.
Reacted by Peter Sandtner, fregante, Sindre Sorhus, Marco Lackovic, Tony Zampogna, Yeikel Santana, Ibrahim Awwal, Michał Turek-Brzozowski, Ivan Prokhorov and Steve Partlow
This is interesting, I needed it recently to avoid conflicts (merge + commit = ok; commit + merge = conflict) but I did it via CLI instead.
This might be possible via API but we don't have API authentication yet in our code. (Edit: we do now!)
The second issue is that we'd have to make another API every time the thread updates to check if the PR is up to date and add the notice+button (avoidable if we just add the button somewhere).
I'm thinking this could be more generically implemented in the Compare page, to have an option to merge without a PR:
On top of this, to facilitate updating the current PR, we could add a link to this page somewhere, if it makes sense. "This page" would be no-reaction-comments...master
It's not clear to me how this is related to rarkins' proposal
"Update branch" means "merge <default branch> into current branch", right? That's what I'm suggesting, except instead of being exclusive to the PR pages, make it work on any branches in any direction.
From an "refined github" point of view, I would definitely prefer to just have the button available right in the PR, otherwise it seems like several non-intuitive clicks to get to the compare branches location to do this.
@bfred-it Ah, got it. I guess that could be useful too, but not something I have ever needed. For non-PR branches, I usually never need to do it in the GitHub UI.
I tried this and it doesn't seem to be feasible (for non-own repos) as the API apparently doesn't care if the user selected "Allow edits from maintainers"
echo'{"base":"features/jvw-103-190-pr-branches", "head":"e37c15c"}'| http POST 'https://api.github.com/repos/jerone/refined-github/merges' Authorization:"token XXXXXX"
HTTP/1.1 403 Forbidden
{
"documentation_url": "https://developer.github.com/v3/repos/merging/#perform-a-merge",
"message": "Must have admin rights to Repository."
}
I was trying to merge sindresorhus/refined-github@master into #1641
However it works correctly when pushing to a repo I have push privileges to:
echo'{"base":"test", "head":"master"}'| http POST 'https://api.github.com/repos/sindresorhus/refined-github/merges' Authorization:"token xxxxxxxxxx"
HTTP/1.1 201 Created
I tried this and it doesn't seem to be feasible (for non-own repos) as the API apparently doesn't care if the user selected "Allow edits from maintainers"
I see... Too bad. Did you try the GraphQL API? Can you report the issue to GitHub support? Looks like an oversight to me.
However it works correctly when pushing to a repo I have push privileges to:
Even if it's just for own PRs on own repos, I think it could still be useful.
@rarkins can you post the HTML of that element and its exact position/selector in the dom? We could reuse it as is. Heck if we're lucky we might be able to just submit the same form without dealing with the API.
<divclass="branch-action-item"><!-- '"` --><!-- </textarea></xmp> --></option></form><formclass="branch-action-btn float-right js-immediate-updates js-tryable-again js-needs-timeline-marker-header" action="/renovatebot/renovate/pull/3553/update_branch" accept-charset="UTF-8" method="post"><inputname="utf8" type="hidden" value="✓" /><inputtype="hidden" name="authenticity_token" value="je8sVSxszMFcyxiUCvCfUF9Kv7St0OCQp0T6/BFcajRz//mm7K/wNx8Qrkdd/bo1pqOP5ZI8oxt92cIV5hGFuA==" /><inputtype="hidden" name="expected_head_oid" value="80f2ee48c58fd9595d0390b4a4faf8c6dfea0a38"><buttontype="submit" data-disable-with="Updating branch…"
class="btn"
>
Update branch
</button></form><divclass="branch-action-item-icon completeness-indicator completeness-indicator-problem"><svgclass="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><pathfill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"/></svg></div><h3class="h4 status-heading">This branch is out-of-date with the base branch</h3><spanclass="status-meta">
Merge the latest changes from <spanclass="branch-name">master</span> into this branch.
</span></div>
Screenshot of same:
Selector: #partial-pull-merging > div.merge-pr.js-merge-pr.js-details-container.Details.is-squashing > div > div > div > div:nth-child(3) > form > button
If you need me to capture anything else, please let me know. I'm not sure how to capture what you ask for re: DOM for example.
Activity
fregante commentedon Apr 4, 2018
This is interesting, I needed it recently to avoid conflicts (merge + commit = ok; commit + merge = conflict) but I did it via CLI instead.
This might be possible via API but we don't have API authentication yet in our code. (Edit: we do now!)
The second issue is that we'd have to make another API every time the thread updates to check if the PR is up to date and add the notice+button (avoidable if we just add the button somewhere).
I'm thinking this could be more generically implemented in the Compare page, to have an option to merge without a PR:
On top of this, to facilitate updating the current PR, we could add a link to this page somewhere, if it makes sense. "This page" would be no-reaction-comments...master
fregante commentedon Nov 11, 2018
Pushing up for discussion
sindresorhus commentedon Nov 12, 2018
Huge 👍 to @rarkins' proposal. I could have used this many times.
sindresorhus commentedon Nov 12, 2018
It's not clear to me how this is related to @rarkins' proposal. It seems like a totally different feature.
fregante commentedon Nov 12, 2018
"Update branch" means "merge <default branch> into current branch", right? That's what I'm suggesting, except instead of being exclusive to the PR pages, make it work on any branches in any direction.
rarkins commentedon Nov 12, 2018
From an "refined github" point of view, I would definitely prefer to just have the button available right in the PR, otherwise it seems like several non-intuitive clicks to get to the compare branches location to do this.
fregante commentedon Nov 12, 2018
sindresorhus commentedon Nov 12, 2018
@bfred-it Ah, got it. I guess that could be useful too, but not something I have ever needed. For non-PR branches, I usually never need to do it in the GitHub UI.
sindresorhus commentedon Nov 12, 2018
That would require two clicks and would not be as clear as a direct button in a PR.
fregante commentedon Jan 1, 2019
I tried this and it doesn't seem to be feasible (for non-own repos) as the API apparently doesn't care if the user selected "Allow edits from maintainers"
https://stackoverflow.com/questions/25859077/merge-from-upstream-using-the-github-api
My test with httpie:
I was trying to merge
sindresorhus/refined-github@masterinto #1641However it works correctly when pushing to a repo I have push privileges to:
sindresorhus commentedon Jan 2, 2019
I see... Too bad. Did you try the GraphQL API? Can you report the issue to GitHub support? Looks like an oversight to me.
Even if it's just for own PRs on own repos, I think it could still be useful.
1 remaining item
IssueHuntBot commentedon Apr 11, 2019
@IssueHunt has funded $80.00 to this issue.
fregante commentedon Apr 16, 2019
@rarkins can you post the HTML of that element and its exact position/
selectorin the dom? We could reuse it as is. Heck if we're lucky we might be able to just submit the same form without dealing with the API.rarkins commentedon Apr 16, 2019
@bfred-it here's the HTML:
Screenshot of same:

Selector:
#partial-pull-merging > div.merge-pr.js-merge-pr.js-details-container.Details.is-squashing > div > div > div > div:nth-child(3) > form > buttonIf you need me to capture anything else, please let me know. I'm not sure how to capture what you ask for re: DOM for example.
fregante commentedon Apr 19, 2019
Related: https://github.community/t5/GitHub-API-Development-and/Equivalent-of-quot-Update-Branch-quot-via-the-API/m-p/20481
IssueHuntBot commentedon May 17, 2019
@sindresorhus has rewarded $72.00 to @bfred-it. See it on IssueHunt
yakov116 commentedon May 30, 2019
https://developer.github.com/changes/2019-05-29-update-branch-api/
fregante commentedon May 30, 2019
That's awesome! They saw our button on Twitter