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

API for Pull Request Checks? #594

Closed
grayaii opened this issue Jul 10, 2017 · 4 comments
Closed

API for Pull Request Checks? #594

grayaii opened this issue Jul 10, 2017 · 4 comments

Comments

@grayaii
Copy link

grayaii commented Jul 10, 2017

I'm trying to find a PR that has a specific failing check.

Is there a way to get information of the checks for a Pull Request?

Here is a screenshot:
pr_check

I didn't see anything obvious from the PR object:

g = Github("user", "password")
user = g.get_user()
org = g.get_organization('my_org')
repo = org.get_repo('myrepo')
for pr in repo.get_pulls():
    print(pr)
    for el in dir(pr):
        print(el)
    sys.exit()
@thewarpaint
Copy link

The way I understand it, in the API statuses belong to commits, not to PRs per se. Try getting the last commit in a PR, and then using http://pygithub.readthedocs.io/en/latest/github_objects/Commit.html#github.Commit.Commit.get_statuses.

@grayaii
Copy link
Author

grayaii commented Sep 6, 2017

Cool. Good catch. Feel free to close this badboy then!
Thanks for looking into this!

@grayaii
Copy link
Author

grayaii commented Sep 6, 2017

One minor thing: It looks like you can now POST to create/update statuses:
https://developer.github.com/v3/repos/statuses/#create-a-status
It would be great if PyGithub supported this :)

@sfdye
Copy link
Member

sfdye commented Apr 7, 2018

@grayaii This is already there. You can use Commit.create_status method to create a status check for your PR. The trick however is you need to find the correct commit to create the status on.

This is what I did in one of my projects:

sha = pr.head.sha
repo.get_commit(sha=sha).create_status()

@sfdye sfdye closed this as completed Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants