2

I may have some expensive tasks/tests and a PR that has not been reviewed could require additional changes.

I don't want to run those expensive tasks for every commit or minor change but only after such changes have been reviewed and approved.

These tasks might not only be expensive to run, but they might also have some run quotas. Moving to a CI build is not desirable given it means that code that breaks the app could get into master and it would require an additional PR to fix.

Is it currently possible in Azure DevOps? How?

mdarefull
  • 829
  • 2
  • 14
  • 24
  • Hi mdarefull, Does my answer help? Please check it and kindly let us know the result. Thanks. – Edward Han-MSFT Mar 25 '21 at 08:08
  • The answer looks good and it makes total sense... I haven't been able to validate it though, we are prioritizing other tasks. Thank you so much for the quick response, I will validate and notify you ASAP – mdarefull Mar 25 '21 at 14:21
  • Hi mdarefull, How about this issue? Does my answer help? I am lookin forward to hearing from you. Thanks. – Edward Han-MSFT Mar 30 '21 at 03:22

1 Answers1

2

If you call this Rest API: Pull Requests - Get Pull Request By Id, the response body will return reviewers array which contains reviewers information. If there is one reviewer approve(or approve with suggestions) this pull request, the value of vote for this reviewer is positive integer, otherwise it is negative integer. Thus this vote property can be used as the flag to check if this pull request is approved or rejected by required reviewers.

Therefore, you could use PR triggers instead of CI triggers, and add a PowerShell task before running those expensive tasks by specifying conditions. And the PowerShell task will run script using above Rest API to check if this pull request is approved and return the result to be the value of flag variable(isApproved), so the flag variable can be passed in those expensive tasks when specifying custom conditions like and(succeeded(), eq(variables['isApproved'], 'true')).

Edward Han-MSFT
  • 2,879
  • 1
  • 4
  • 9