Understanding pull_request_id in Notification Policy Data Input

Last updated: September 9, 2025

When using notification policies, the availability of certain data inputs like run_updated.run.commit.pull_request_id depends on how the proposed runs are initiated.

Pull Request ID Availability

The pull_request_id field will be available in your notification policy's data input when:

  1. Your stack has a push policy attached that handles pull request diffs

  2. The proposed run is created from a pull request diff rather than push affected files

Example Push Policy Configuration

Here's an example of a push policy that enables access to pull request information:

package spacelift

# Handle pull request changes
propose {
    is_pr
    pr_changes
    not stack_locked
}

# Check for PR changes
pr_changes {
    startswith(input.pull_request.diff[_], input.module.project_root)
}
pr_changes {
    startswith(input.pull_request.diff[_], input.stack.project_root)
}