pygithubgithub-ci

Is there a way in Python to find the results of a Github CI?


I am using PyGithub to run tests on every pull request in a repository.
I'd like to only run tests on pull requests that have passed my CI.
Is there a way to query the results of the CI in Python?
For example something like:

for pull in repository.get_pulls():
    if pull.get_check().status == True:
        #run test on pull

(something like get_check() is what I'm looking for)

Thanks so much!


Solution

  • This is it: https://pygithub.readthedocs.io/en/latest/github_objects/Commit.html#github.Commit.Commit.get_statuses

    Which returns a: https://pygithub.readthedocs.io/en/latest/github_objects/CommitStatus.html#github.CommitStatus.CommitStatus

    Which is a form of: https://docs.github.com/en/rest/commits/statuses