How to trigger Spacelift runs only for PR changes

Last updated: September 9, 2025

By default, Spacelift triggers runs whenever changes are pushed to tracked branches, including when merging from main. This can result in unnecessary runs when performing operations like git merge main && git push.

Limiting runs to PR changes only

To trigger runs only for changes introduced in pull requests (and not for every commit), you can implement a push policy. This helps reduce noise and prevent unnecessary runs from unrelated commits.

Implementation

Use our example push policy from the policies example library to implement this behavior. The policy will suppress runs unless the change originates directly from a pull request.

This approach is particularly useful when you want to maintain clean run history and avoid redundant infrastructure changes triggered by merge commits.