Skip to content

Commit

Permalink
docs: clarify blocking PR docs (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
alikhajeh1 authored Dec 23, 2024
1 parent 28077e3 commit cba4565
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/infracost_cloud/guardrails.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,20 @@ The following screenshot shows an example pull request comment with a custom mes

### 5. Block pull requests

This feature works by failing the CI/CD pipeline that runs Infracost (`infracost comment` will `exit 1`). Depending on how you have configured your source control system this blocks the pull request from being merged, but your source control system admins can usually override this during urgent cases.
This feature prevents pull requests from being merged by signaling to your source control system (e.g., GitHub) that a pull request check has failed. While Infracost handles the failure notification, you must configure your source control system to block merges when status checks fail. In urgent cases, source control system admins can usually override these settings.

To setup this feature follow the instructions below for your source control system.
To set up this feature, follow the steps below based on your source control system:

1. Enable the "Block pull request from being merged" option when you create the guardrail.
1. **Enable Blocking in Infracost**: In Infracost, enable the "Block pull request from being merged" option when creating the guardrail.

<img src={useBaseUrl("img/infracost-cloud/guardrails/actions.png")} alt="Blocking pull requests" />

2. Configure your source control system to require status checks to pass before merging pull requests.
2. **Configure Your Source Control System**: Configure your source control system to require the Infracost status check to pass before merging pull requests.

**GitHub App**:
1. Go to Settings > Branches > and tick the "Require status checks to pass before merging" option under Protect matching branches.
1. Infracost needs to be marked as a Required Check in GitHub. The way that can be done for a single repository is in GitHub > Settings > Branches > and tick the "Require status checks to pass before merging" option under Protect matching branches. See the following step on how this can be done in enterprises with many code repos.
<img src={useBaseUrl("img/infracost-cloud/guardrails/github-require-status-pass.png")} alt="Configure GitHub to require status checks to pass before pull requests can be merged" />
2. GitHub's [Rulesets feature](https://github.blog/news-insights/product-news/github-repository-rules-are-now-generally-available/) can be used to make Infracost a required status check across all of your repos in your organization. The docs for this are [here](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets). [This docs section](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets#about-rule-layering) describes how rulesets interact at the organization and repo level.

**Azure Repos App**:
1. Go to Project Settings > Repositories > Policies
Expand Down

0 comments on commit cba4565

Please sign in to comment.