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
Meta: Use new APIs in update-pr-from-base-branch
#6103
Conversation
update-pr-from-base-branch
update-pr-from-base-branch
@busches will this affect GHE? |
@yakov116 you can check the GHE docs to see what, if any, versions support it yet. Guessing it's not in any version yet. |
@yakov116 we have probably never waited for GHE to use updated APIs |
This will break the entire feature, since the api call will fail. I don't remember in the past ever having a case where an API was not available on GHE. However I do remember holding off on v4 until GHE had normal support. I am not waiting to support the API I am just using a fallback. |
I do use this feature all the time, so I appreciate the thought. 😃 |
}; | ||
comparison: { | ||
status: 'BEHIND' | 'DIVERGED' | 'AHEAD' | 'IDENTICAL'; | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can merge these into flat object, no need to have prInfo and comparison keys. While we're at it it can be simplified further, like setting diverged: true
instead of matching strings outside
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're at it it can be simplified further, like setting
diverged: true
instead of matching strings outside
Can you explain this one more time I am not sure I understood what you said
if (repository.pullRequest.headRef.compare.status !== 'DIVERGED') { | ||
return; | ||
} | ||
|
||
return repository.pullRequest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just mixes the logic of a specific feature with this generic get pr info
function, which could return the PR info regardless of the need to update the PR.
I suggested returning diverged: true
for both API calls, i.e. something like
if (repository.pullRequest.headRef.compare.status !== 'DIVERGED') { | |
return; | |
} | |
return repository.pullRequest; | |
return { | |
...repository.pullRequest, | |
diverged: repository.pullRequest.headRef.compare.status === 'DIVERGED' | |
}; |
And the logic just checks pr.diverged
, or better yet pr.needsUpdate
as a combination of mergeable
and diverged
I suppose it's ok as is for now if it's tested, but it'll need to be changed eventually. 👍
Test URLs
refined-github/sandbox#9 (Conflict)
refined-github/sandbox#11
Screenshot
NA