> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/infrastructure-as-code-management/3.0/platform/iacm-pipelines/operations-overview/pr-automation-operations-overview.md).

# PR Automation

{% @harness-package-selector/package-selector platforms="%5B%7B%22label%22%3A%22Approval%20Step%22%2C%22slug%22%3A%22approval-step%22%2C%22path%22%3A%22infrastructure-as-code-management%2Fplatform%2Fiacm-pipelines%2Foperations-overview%2Fapproval-step-operations-overview%22%7D%2C%7B%22label%22%3A%22Queue%20Step%22%2C%22slug%22%3A%22queue-step%22%2C%22path%22%3A%22infrastructure-as-code-management%2Fplatform%2Fiacm-pipelines%2Foperations-overview%2Fqueue-step-operations-overview%22%7D%2C%7B%22label%22%3A%22Drift%20Detection%22%2C%22slug%22%3A%22drift-detection%22%2C%22path%22%3A%22infrastructure-as-code-management%2Fplatform%2Fiacm-pipelines%2Foperations-overview%2Fdrift-detection-operations-overview%22%7D%2C%7B%22label%22%3A%22PR%20Automation%22%2C%22slug%22%3A%22pr-automation%22%2C%22path%22%3A%22infrastructure-as-code-management%2Fplatform%2Fiacm-pipelines%2Foperations-overview%2Fpr-automation-operations-overview%22%7D%5D" selectedPlatform="pr-automation" %}

Harness IaCM supports reviewing infrastructure changes via pull request automation. This functionality allows developers to see the changes, such as the plan details, as comments in the PR, so they can see what the resource changes will be before applying the plan. Additionally, Harness IaCM also supports [Open Policy Agent (OPA)](/infrastructure-as-code-management/platform/policy-and-governance/opa-workspace.md) for more advanced policy enforcement.

***

### Create a PR pipeline <a href="#create-a-pr-pipeline" id="create-a-pr-pipeline"></a>

{% tabs %}
{% tab title="Interactive guide" %}
Create a pipeline similar to the way described in the [provision workspace topic](/infrastructure-as-code-management/3.0/platform/workspaces/provision-workspace.md), and select **Pull Request** as the operation.

{% embed url="<https://app.tango.us/app/embed/58b67758-f36c-410c-8ea4-99236bb01235?defaultListView=false&hideAuthorAndDetails=true&makeViewOnly=true&skipBranding=false&skipCover=true>" %}
Create a PR pipeline
{% endembed %}
{% endtab %}

{% tab title="Step-by-step" %}

1. Sign in to [app.harness.io](https://app.harness.io) and select the **Infrastructure** module from the module pane.
2. Create a PR pipeline. Create a pipeline similar to the way described in the [provision workspace guide](/infrastructure-as-code-management/3.0/platform/workspaces/provision-workspace.md), and select **Pull Request** as the operation.
   {% endtab %}
   {% endtabs %}

***

### Create a pipeline trigger <a href="#create-a-pipeline-trigger" id="create-a-pipeline-trigger"></a>

{% tabs %}
{% tab title="Interactive guide" %}
{% embed url="<https://app.tango.us/app/embed/d2e2b039-0fd6-46f3-b271-ba4d14c8b8a7?defaultListView=false&hideAuthorAndDetails=true&makeViewOnly=true&skipBranding=false&skipCover=true>" %}
Create a Pipeline trigger
{% endembed %}
{% endtab %}

{% tab title="Step-by-step" %}

1. After saving the pipeline, select **Trigger**, and then add a new trigger.
2. Select a **Webhook** trigger with the same connector as the workspace it is configured with.
3. Fill in the following details:
   * **Trigger name:** Add a name for the trigger.
   * **Connector**: Select the same one your workspaces are using.
   * **Event:** Select **Pull Request**.
   * **Actions:** Select **Any Actions** or specific actions from which you want the PR pipeline to be triggered.
   * Select **Continue**.
4. On the second page of the trigger editor, you can specify that the trigger should only be activated when files within a certain folder are changed, for example, the trigger activates only if the PR affects files in the `terratest/examples/` folder.
   {% endtab %}
   {% endtabs %}

### Review plan output in pull requests <a href="#review-plan-output-in-pull-requests" id="review-plan-output-in-pull-requests"></a>

Once the trigger is defined, create a PR in your git repository. You will see the trigger activation on the **Trigger** tab:

![Trigger activation](/files/L1CqfG6zMyfBMDE8MFHr)

You will see the plan as a comment in the PR:

![Plan output as PR comment](/files/lx3stAQ1hoeZjr3Yp2fG)

{% hint style="info" %}
**SECURITY MEASURE FOR PUBLIC REPOSITORIES**

As a security measure, comments will not be populated if the repository is public. To override it, add the Environment Variable `HARNESS_PASSWORD_API` with the git repository token or secret set as the value.
{% endhint %}
