Skip to content

Implements getPullRequestForCommit and getAccountForCommit for Azure and Bitbucket #4243

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

sergeibbb
Copy link
Member

@sergeibbb sergeibbb commented Apr 22, 2025

Description

Implements getPullRequestForCommit and getAccountForCommit for Azure and Bitbucket.
Solves #4192

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

@sergeibbb sergeibbb force-pushed the 4192-get-pr-for-commit branch from 27e89a7 to 0a19579 Compare April 22, 2025 12:58
@d13 d13 self-requested a review April 23, 2025 15:31
Copy link
Contributor

@axosoft-ramint axosoft-ramint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I'm not able to get this to work. I'm getting a bunch of errors with Azure DevOps that say invalid response body...unexpected token <.

Screenshot:

image

But I think it might be some issue with the Azure DevOps integraiton outside of this PR, because it is affecting other calls as well.

Will investigate, and re-test once I've addressed it. In the meantime, here are a few tiny comments.

return { name: raw, email: '' };
}

export interface BitbucketCommit {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can maybe extend BitbucketBriefCommit?

'warn',
`GitLens cannot access Bitbucket PRs for commits.
Allow access by visiting [this commit](${revLink}) on Bitbucket and click “Pull requests” under the “Apps” section on the bottom right
or [read our docs](https://help.gitkraken.com/gitlens/gitlens-troubleshooting/#enable-showing-bitbucket-pull-request-for-a-commit) for more info.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page doesn't exist (or, at least, 404s for me). We should make sure it does before merging.

_options?: {
avatarSize?: number;
},
): Promise<UnidentifiedAuthor | undefined> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we probably want a comment on why we need to use UnidentifiedAuthor type here even when we find the author, because at a glance it sounds confusing. I'm guessing it's because the API never gives us an id/username we can use, and the more solid types require it?

@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

### Fixed

- Gets "associated PR for commit" working on Bitbucket and Azure DevOps ([#4192](https://github.com/gitkraken/vscode-gitlens/issues/4192))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the changelog represents the user-facing change reflected in the issue, probably more along something like "added support for associated BitBucket, BitBucket Server, and Azure DevOps pull requests on commits" in the "Added" category, or "fixed _______ not appearing on commits" if we want it in the "Fixed" category.

@d13
Copy link
Member

d13 commented Apr 24, 2025

Unfortunately, I'm not able to get this to work. I'm getting a bunch of errors with Azure DevOps that say invalid response body...unexpected token <.

Screenshot:

image

But I think it might be some issue with the Azure DevOps integraiton outside of this PR, because it is affecting other calls as well.

Will investigate, and re-test once I've addressed it. In the meantime, here are a few tiny comments.

Looks like the response returned HTML instead of JSON

@sergeibbb
Copy link
Member Author

@axosoft-ramint @d13
Thank you! I'll look at it

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

Successfully merging this pull request may close these issues.

Get "associated PR for commit" working on all providers that don't have it
3 participants