Feature #5687
closedsystem_patches add possibility to add pull-request
0%
Description
Lots of committers use the github editor (including myself).
The edit generates a commit for each file.
So, most of the pull-requests have multiple commits to fix a single issue.
To test these fixes, you now have to add multiple commit-id's to system_patches in order to see it in action.
Would it be a good idea to also allow a PR-url to be added as a patch ?
The github API makes it fairly easy to get all the commit-id's for a single pull-request.
demo code:
<?php function get_content_from_github($url) { $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1); //To comply with https://developer.github.com/v3/#user-agent-required curl_setopt($ch, CURLOPT_USERAGENT, "nothing"); $content = curl_exec($ch); curl_close($ch); return $content; } function get_PR_commit_ids_from_github($url) { $response=get_content_from_github($url); $json=json_decode($response, true); //var_dump($json); if(!empty($json)) { foreach($json as $item) { if(preg_match("/^[0-9a-f]{5,40}$/", $item['sha'])) { $result[] = $item['sha']; } else { $result = ""; } } } else { $result = "" ; } return $result ; } print_r(get_PR_commit_ids_from_github('https://api.github.com/repos/pfsense/pfsense/pulls/2318/commits')); ?>
Updated by Renato Botelho over 8 years ago
github allow to get a single diff for a Pull Request with all commits combined, you just need to add the suffix .diff in the end of PR URL
Updated by jeroen van breedam over 8 years ago
right, luckily i didn't start on implementing this into system_patches
@rbgarga: got a github cheat-sheet somewhere for this kind of stuff ?
Updated by Renato Botelho over 8 years ago
- Status changed from New to Rejected
Not sure, the only page I remember is https://github.com/blog/967-github-secrets
I'm closing this ticket