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

WIP add combined status func to pull requests #897

Open
wants to merge 3 commits into
base: master
from

Conversation

@markddavidoff
Copy link

@markddavidoff markddavidoff commented Oct 16, 2018

No description provided.

@markddavidoff markddavidoff force-pushed the markddavidoff:add-pr-combined-status branch from 4e36909 to b39f98f Oct 16, 2018
Copy link
Collaborator

@omgjlk omgjlk left a comment

I've left some in-line comments. There isn't really a direct API for this via the pull request. what's happening here is a convenience method making use of knowledge of how the APIs are structured, in that you could take a provided statuses url and do a string replacement on it. Not that I expect the endpoint to change in the future, it just doesn't feel right. I just can't suggest a better way to get there from a pull request object.

def combined_status(self):
""" Retrieve the combined status for this Pull Request
:rtype:
:class:`~github3.repos.CombinedStatus`

This comment has been minimized.

@omgjlk

omgjlk Oct 16, 2018
Collaborator

This would need a .. versionadded:: 1.3.0 to reflect when this function was added to the API.

:rtype:
:class:`~github3.repos.CombinedStatus`
"""
combined_status_url = self.statuses_url.replace('/statuses/', '/status/')

This comment has been minimized.

@omgjlk

omgjlk Oct 16, 2018
Collaborator

This feels a bit clumsy, but I can't immediately think of a better way to do this. Perhaps another reviewer will have a suggestion.

This comment has been minimized.

@markddavidoff

markddavidoff Oct 16, 2018
Author

I was also struggling to find a neater way :/ i don't see any other place we actually build urls so i had nothing to go off

This comment has been minimized.

@sigmavirus24

sigmavirus24 Oct 17, 2018
Owner

What does statuses_url look like (when the API provides it)?

This comment has been minimized.

@markddavidoff

markddavidoff Oct 17, 2018
Author

you can find it here: https://developer.github.com/v3/pulls/
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",

src/github3/pulls.py Outdated Show resolved Hide resolved
@markddavidoff markddavidoff changed the title add combined status func to pull requests WIP add combined status func to pull requests Oct 18, 2018
@markddavidoff
Copy link
Author

@markddavidoff markddavidoff commented Oct 18, 2018

@sigmavirus24 @omgjlk I don't know another way to do this, so before I write tests I'd like to know, is this is too smelly to get accepted? (Any chance that endpoint will be added to actual API?)

@sigmavirus24
Copy link
Owner

@sigmavirus24 sigmavirus24 commented Oct 19, 2018

Any chance that endpoint will be added to actual API?

I don't think either of us can answer that. This project works primarily from the developer.github.com documentation and secondarily from whatever the API's actual (not necessarily documented) behaviour is. By this I mean, we use the documentation to find what we might be able to do, and exercise the API to find out how it really works. At the moment, I'm leaning somewhat away from this. I believe combined statuses are currently specific to commits, and while that implementation detail really shouldn't be in every downstream integrator, it is available today.

@markddavidoff
Copy link
Author

@markddavidoff markddavidoff commented Oct 22, 2018

Changed the way the url is built, tests coming soon.

@sigmavirus24 sigmavirus24 added this to In Progress in Testing Projects Nov 20, 2018
@sigmavirus24 sigmavirus24 removed this from In Progress in Testing Projects Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.