Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting pull request # using Github API #14

Open
robertzk opened this issue Oct 11, 2014 · 1 comment
Open

Extracting pull request # using Github API #14

robertzk opened this issue Oct 11, 2014 · 1 comment

Comments

@robertzk
Copy link
Contributor

If GITHUB_API_TOKEN is set, then the following command will provide the github pull request for the current branch

curl -s "https://api.github.com/repos/avantcredit/avant-basic/pulls?access_token=$GITHUB_API_TOKEN&head=avantcredit:tu-freeze-78237690" | grep -o 'pulls/\([0-9]\+\)' | head -n1 | grep -o '[0-9]\+'

Note you the need the organization (avantcredit here) and the branch name (tu-freeze-78237690) here. You can then wrap this whole expression with backticks or make it a separate function, and use it to go straight to a pull request.

Since calling the Github API shouldn't be done too often, there should be a caching mechanism that records the pull request # for a given branch and uses that instead.

@peterhurford
Copy link
Owner

Good work! 👍

@peterhurford peterhurford changed the title Extracting pull request # using Github API TODO: Extracting pull request # using Github API Oct 11, 2014
@peterhurford peterhurford added this to the v1 Release milestone Dec 31, 2014
@peterhurford peterhurford changed the title TODO: Extracting pull request # using Github API Extracting pull request # using Github API Apr 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants