Skip to content

GitPullRequest getCommits() is always null #71

@razisam

Description

@razisam

Issue Template

When calling the git API, the getCommits() always returns null:

        AzDClientApi webApi = new AzDClientApi(Constants.ORGANIZATION_NAME, Constants.PROJECT_NAME, Constants.PERSONAL_ACCESS_TOKEN);
        GitApi git = webApi.getGitApi();
        PullRequests pullRequests = git.getPullRequests(Constants.REPO_NAME);
        List<GitPullRequest> gitPullRequests = pullRequests.getPullRequests();
        if (gitPullRequests == null) {
            return;
        }
        for (GitPullRequest gitPullRequest : gitPullRequests) {
            List<GitCommitRef> commits = gitPullRequest.getCommits();
// commits is always null

i tried with 5.0.10 and i also tried with 6.0.0-SNAPSHOT.

what am i doing wrong?

my goal is, to get all changed files from a pull request, to analyze the path of the files and add labels.

adding labels works fine:
git.createPullRequestLabel(Constants.REPO_NAME, gitPullRequest.getPullRequestId(), "azd-tooling-test-feature-xyz");

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions