I'm working on an extension to azure devops. The intent is to create pull requests automatically when changes are pushed to a specific branch and then add some reviewers to it.
There is GitPullRequest
in the azure devops node api and it is possible to add reviewers to it by doing:
const pr: gi.GitPullRequest = <gi.GitPullRequest>{};
// ... some lines omitted...
pr.reviewers = [];
const reviewer = <gi.IdentityRefWithVote> {id: tl.getVariable("Build.RequestedForId")}
pr.reviewers.push(reviewer);
The above adds a reviewer to the PR (by taking the id from the environment variable). I would like to also use the username of team members eg. me@example.com
look up their id and add those to the reviewers. I've tried using the usernames as uniqueName
for the IdentityRefWithVote
and adding those, but it complains that the identifier is missing.
Is there a way of doing this? The only way I have come up with is to fetch all the teams and then for each team fetch the members and then match up the identities that way. However, that seems convoluted :(