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

Azure DevOps - Failed to add reviewers #3183

Closed
JamieMagee opened this issue Feb 7, 2019 · 4 comments · Fixed by #3532
Closed

Azure DevOps - Failed to add reviewers #3183

JamieMagee opened this issue Feb 7, 2019 · 4 comments · Fixed by #3532
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@JamieMagee
Copy link
Contributor

What Renovate type are you using?
Renovate CLI

Describe the bug
With the following renovate.json I am unable to automatically add reviewers to PRs created by renovate.

{
  "extends": ["config:base", ":rebaseStalePrs"],
  "reviewers": ["MY_EMAIL_ADDRESS"]
}

Did you see anything helpful in debug logs?

Failed to add reviewers (repository=..., dependencies=gradle, branch=renovate/gradle-5.x)
"assignees": [],
"err": {
  "message": "azureApiCore.getTeamMembers is not a function",
  "stack": "TypeError: azureApiCore.getTeamMembers is not a function\n    at Promise.all.teams.map (/home/jamie/.npm/_npx/24728/lib/node_modules/renovate/lib/platform/azure/index.js:574:28)\n    at Array.map (<anonymous>)\n    at Object.addReviewers (/home/jamie/.npm/_npx/24728/lib/node_modules/renovate/lib/platform/azure/index.js:571:11)\n    at processTicksAndRejections (internal/process/next_tick.js:81:5)"
}

Expected behavior
I expect to be able to add required reviewers to PRs based on email address

@rarkins rarkins added type:bug Bug fix of existing functionality ready priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others labels Feb 7, 2019
@rarkins
Copy link
Collaborator

rarkins commented Feb 8, 2019

It seems that the API endpoint(s) used for Azure DevOps have changed and we need to work out the new way or disable reviewers completely for Azure so that we don't error.

Replace or remove:

async function addReviewers(prNo, reviewers) {
logger.trace(`addReviewers(${prNo}, ${reviewers})`);
const azureApiGit = await azureApi.gitApi();
const azureApiCore = await azureApi.getCoreApi();
const repos = await azureApiGit.getRepositories();
const repo = repos.filter(c => c.id === config.repoId)[0];
const teams = await azureApiCore.getTeams(repo.project.id);
const members = await Promise.all(
teams.map(
async t =>
/* eslint-disable no-return-await */
await azureApiCore.getTeamMembers(repo.project.id, t.id)
)
);
const ids = [];
members.forEach(listMembers => {
listMembers.forEach(m => {
reviewers.forEach(r => {
if (
r.toLowerCase() === m.displayName.toLowerCase() ||
r.toLowerCase() === m.uniqueName.toLowerCase()
) {
if (ids.filter(c => c.id === m.id).length === 0) {
ids.push({ id: m.id, name: r });
}
}
});
});
});
await Promise.all(
ids.map(async obj => {
await azureApiGit.createPullRequestReviewer(
{},
config.repoId,
prNo,
obj.id
);
logger.info(`Reviewer added: ${obj.name}`);
})
);
}

@JamieMagee
Copy link
Contributor Author

There's a new major version of azure-devops-node-api (breaking? Not sure if they follow semver). Perhaps that's useful? @renovate[bot] opened a PR about it in #2958.

@rarkins
Copy link
Collaborator

rarkins commented Feb 13, 2019

Yes, there's a new major available. I'll trigger the PR so that we can test it and see if the breaking changes affect us or not.

@renovate-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 15.17.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants