1
votes

I have been reading this : https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml to find out which user from Github triggered the build. (There is a build for every commit) I tried using Build.RequestedFor but it outputs Github

1

1 Answers

1
votes

Access github username in Azure Devops predefined variables

I suppose the user from Github triggered the build is not the owner or admin of the Github repo.

As test, I submit the change to the github repo with different accounts, one is the owner/Admin, another is a collaborator. I could get the user name and e-mail for the account owner/Admin by the predefined variables Build.RequestedFor and Build.RequestedForEmail:

enter image description here

But, if I use the collaborator account, I could could not find out those two values:

enter image description here

I think this is by designed to protect user information, otherwise, we could get other user's usernames and emails through a github connection service. Obviously this is not secure. This should also be the reason why the value you get is github.

Hope this helps.