---
description: >-
  Describes Spacelift's support for commenting on pull requests, as well as for
  taking action due to comments on pull requests
---

# Pull Request Comments

## What is supported?

* [Pull Request Plan Commenting](#pull-request-plan-commenting)
  * Posting the output of the plan as a comment on your pull request.
* [Pull Request Comment-Driven Actions](#pull-request-comment-driven-actions)
  * Taking some action within Spacelift based upon a comment on your pull request.

### Pull Request Plan Commenting

To enable this feature, simply add the label `feature:add_plan_pr_comment` to the stacks you wish to have plan commenting enabled for on pull requests.

![](https://3862190545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LshwwDZmA4HXN0k9e8O%2Fuploads%2FsYCj9r4cTL0pTF8ZBq6U%2FScreen%20Shot%202022-06-27%20at%204.35.36%20PM.png?alt=media\&token=301f733b-b66d-4137-b04f-048d592d3556)

Once enabled, on any future pull request activity, the result of the plan will be commented onto the pull request.

![](https://3862190545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LshwwDZmA4HXN0k9e8O%2Fuploads%2FQ9eGDYP8EP7GqcnxkfoR%2FScreen%20Shot%202022-06-27%20at%204.34.46%20PM.png?alt=media\&token=23ef83e5-7b01-49ad-a7b2-c445c097da4c)

### Pull Request Comment-Driven Actions

To enable support for pull request comment events in Spacelift, you will need to ensure the following permissions are enabled within your VCS app integration. Note that if your VCS integration was created using the Spacelift VCS setup wizard, then these permissions have already been setup automatically, and no action is needed.

* Read access to `issues` repository permissions
* Subscribe to `issues:comments` event

Assuming the above permissions are configured on your VCS application, you can then access pull request comment event data from within your Push policy, and build customizable workflows using this data.&#x20;

{% hint style="warning" %}
Please note that Spacelift will only evaluate comments that begin with`/spacelift` to prevent users from unintended actions against their resources managed by Spacelift. Furthermore, Spacelift only processes event data for **new** comments, and will not receive event data for edited or deleted comments.
{% endhint %}

Example policy to **trigger a tracked run from a pull request comment** event:

```
package spacelift

track {
    input.pull_request.action == "commented"
    input.pull_request.comment == concat(" ", ["/spacelift", "deploy", input.stack.id])
}
```

Using a policy such as the example above, a user could trigger a tracked run on their Spacelift stack by commenting something such as:

```
/spacelift deploy my-stack-id
```
