Skip to main content

Expose GitHub PR state to approval policies for promoted runs

We want reviewers to see the Spacelift plan on a PR before approving, then let people promote and apply that PR only once GitHub reports it approved by a code owner and mergeable (required checks passing). Push policies see pull_request.approved / mergeable / undiverged, but only when a run is created, and they aren’t re-evaluated when a review lands. Approval and plan policies, which do run when a promoted run is created, get no PR state, and http.sendis disabled. So today we can only reject all promotions of PR runs (an approval policy checking run.commit.exist_on_tracked_branch and triggered_by) and send people through a /spacelift deploy comment handled by the push policy.

Request (any one of these would work):

  1. Include the PR’s current approved, mergeable and undiverged in the approval policy input for runs whose commit has a pull_request_id, fetched when the policy is evaluated.

  2. Re-evaluate approval policies when a PR review is submitted or the PR’s mergeability changes.

  3. Carry a proposed run’s policy flags over to the tracked run created by promoting it, and document this.

Why the plan must come before approval: code review alone misses plan-only surprises. For example, a disk is resized during an incident, and a later PR’s harmless-looking size change then plans a delete-and-recreate. We want that caught in review.

Related: More Controls for PR Promotion. Option 1 would also cover its behind-main case.

Workaround
Problem

Log in to comment and vote

No comments yet

Be the first to share your thoughts.