0

I have 4 Azure Pipelines that perform checks when a PR is created. They are configured such that certain checks are excluded/included based on the changes made. For example, if the PR only contains frontend code changes, there is no reason to run the check pipeline associated with checking backend code changes.

In the GitHub branches configuration, there is an option "Require status checks to pass before merging" but when you check that you have to select which pipelines must pass. Doing so sets it so that the pipeline you selected must run and pass in order to merge, but with our configuration, it may not have a reason to run so the PR would be stuck forever.

Is there a way to have GitHub status checks required to pass before merging, but the status checks that must pass are determined at the time of the PR creation, not beforehand?

B. Witter
  • 564
  • 6
  • 19

1 Answers1

1

Based on my test, I could reproduce this situation.

When I create multiple status check(Azure Pipeline) in Github, these checks only accept the build status after the Pull Request was created.

Therefore, due to some configuration (such as path filter), if the related pipeline does not run, then this PR will be stuck.

enter image description here

In this situation, you could use API to send the existing Azure Pipeline Status to Status check.

API URL:

Post https://api.github.com/repos/{owner}/{repo}/statuses/{sha}

Reuqest Body:

{
  "state": "success",
  "target_url": "Build Status badge Url",
  "description": "Build verify",
  "context": "Staus Check name"
}

Then you could pass the status check in Github.

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28
  • 1
    Thanks Kevin! I think I was a little unclear as to my desired outcome. The end goal, as simply stated as possible, is that I want any checks that are triggered, for whatever reason, to be green before the PR can be merged. So whether or not 1 or 3 checks are detected in a PR, all of them should be passing in order to merge. Is that possible? – B. Witter Oct 27 '20 at 16:23
  • Hi @B.Witter. I could understand your requirements. But when you set the status check as required, these required checks must be passed to complete the merge. If 2 is necessary, then only 1 and 3 can not complete the merge. So your idea can't be realized now. The workaround is using the api to manually send the pass status to the status check. In my opinion, your needs are indeed very valuable. – Kevin Lu-MSFT Oct 28 '20 at 01:21
  • is there a way to suggest changes to github for something like this? I am not finding anything on the contact page. – B. Witter Oct 28 '20 at 15:01
  • Hi @B.Witter. You could share your feedback in this site: https://support.github.com/contact/feedback?contact[category]=Pull%20requests%20and%20code%20review On the other hand, if the answer could give you some help, you may consider accepting it. Thanks. – Kevin Lu-MSFT Oct 29 '20 at 01:22