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
So probably better to use the github / gitlab apis?
Using apis
To be able to support git push for a pull request, the most reliable way is to use the git providers api. We would need
to detect self-hosted git and find the relavant api endpoint ie: https://api.github.com/ becomes https://github.yourcompany.com/
Using the Github APIs:
We can setup the origin and upstream and get the correct branch name
The text was updated successfully, but these errors were encountered:
michaelbrewer
changed the title
Feat(git-clone): add support for pull request and merge request urls
feat(git-clone): add support for pull request and merge request urls
Apr 2, 2024
michaelbrewer
changed the title
feat(git-clone): add support for pull request and merge request urls
rfc(git-clone): add support for pull request and merge request urls
Apr 17, 2024
Overview
When building an "open in coder" workflow from any url, we could also support Github Pull Requests and Gitlab Merge Requests.
Notes on Pull Request
Neither can allow for pushes to go to the right branch
Github:
git fetch origin pull/<PR>/head:pr/<PR>; git switch pr/<PR>
git fetch origin merge-requests/<PR>/head; git switch FETCH_HEAD
eg:
git clone https://github.com/michaelbrewer/repo-tests.log.git cd repo-tests.log git fetch origin pull/1/head:pr/1 git switch pr/1
Gitlab:
git fetch origin merge-requests/<MR>/head:pr/<MR>; git switch pr/<MR>
git fetch origin merge-requests/<MR>/head; git checkout FETCH_HEAD
eg:
git clone https://gitlab.com/mike.brew/repo-tests.log.git cd repo-tests.log git fetch origin merge-requests/1/head:mr/1 git switch mr/1
So probably better to use the github / gitlab apis?
Using apis
To be able to support
git push
for a pull request, the most reliable way is to use the git providers api. We would needto detect self-hosted git and find the relavant api endpoint ie:
https://api.github.com/
becomeshttps://github.yourcompany.com/
Using the Github APIs:
We can setup the
origin
andupstream
and get the correct branch nameGitlab api
Gitlab version has to do 3 api calls and
id
is a best guessUsing Bitbucket API
From Get a pull request
The text was updated successfully, but these errors were encountered: