Search code examples
githubazure-devopscicd

Bypass GitHub branch protection rule


we have a GitHub repository enabled with Branch project policy for Master branch with default pull request reviewers.

There is a node.js pipeline created in azure DevOps which on success tries to commit a file to Master branch, however it is failing because of the branch restriction policy.

I've tried with the option "Allow specified actors to bypass required pull requests" but that didn't work.

How can I override the policy and push the file during pipeline execution.

Any help is much appreciated


Solution

  • Usually, when we create a new pipeline, we need to choose Where is your code?. When we choose GitHub, it will auto link the GitHub to Azure DevOps with creating a GitHub App named Azure Pipelines in GitHub. Your pipeline will run with the Azure Pipelines identity without using your personal GitHub identity.

    So, you should add the GitHub App named Azure Pipelines to the "Allow specified actors to bypass required pull requests".

    enter image description here

    After this, the pipeline can bypass GitHub branch protection rule.

    enter image description here