Plans on Pull Requests: How InfraOrcinus Reports Back to Git and Handles a Merge

By Chirag Panchal · Founder & Lead Architect · · 7 min read

How a pull request becomes a plan: a speculative, apply-free plan of the pull request's head commit, one comment per environment that is edited in place instead of repeated, a separate commit status for each environment, and a merge that starts exactly one run. Webhook security, what credentials the feedback needs, and what is not posted yet.

Development Status & Architectural Evolution: InfraOrcinus is in active development. Architecture specifications, internal interfaces, and operational protocols described herein reflect our current engineering design and are continuously refined to make InfraOrcinus robust, resilient, and enterprise-grade.

The best moment to catch an infrastructure mistake is while the change is still a pull request, when fixing it costs a comment and a push. The reviewer, though, is reading a diff of configuration files. They cannot see what Terraform would do, what policy would say about it or what it would cost.

InfraOrcinus closes that gap by planning the pull request itself and posting the result back where the reviewer already is. This article describes what happens on each Git event, how the feedback is kept readable when many environments share a repository, and why a merge starts exactly one run.


1. What Each Git Event Does

Event What happens
Pull request opened, reopened or updated A speculative plan of the pull request's head commit runs for every environment whose blueprint matches the repository and target branch.
Push to another branch A speculative plan of the pushed commit, like a pull request.
Push to the default branch A run is queued for affected environments. Applying is still gated by the normal named human approval.
Pull request merged The blueprint is updated to the merge commit. The push that the merge produces is what starts the run.

Matching is by repository and branch: only environments built from a blueprint whose Git source matches the event are affected, so an unrelated repository never triggers anything.

A speculative plan applies nothing

It never asks for approval, never takes the environment's run lock, and does not change the environment's state. It therefore cannot block the real run that a merge starts later. When it finishes, the run is closed as a plan-only run, shown in the product as "Plan complete", with its plan step marked finished and its timer stopped.


2. A Merge Starts One Run, Not Two

A merge produces two webhook deliveries from GitHub and Azure DevOps: a "pull request merged" event and a push to the default branch. If both started a run, the same commit would be planned twice.

So they have different jobs. The merged-pull-request event only reconciles: it moves the blueprint to the merge commit, which is also how a blueprint published from Studio becomes Git-backed. The push event starts the run. Whichever arrives first, the result is one blueprint update and one run.


3. What the Reviewer Sees

When a speculative plan finishes, two things are posted to the pull request.

A comment with the resource counts (added, changed, destroyed), any policy violations, the monthly cost estimate and a link back to the run.

A commit status, which is failure when a mandatory policy blocks the plan and success otherwise, so branch protection can require it.

Two details keep this from becoming noise on a busy repository:

  • One comment per environment, edited in place. Each comment carries an invisible marker naming its environment. On the next push, InfraOrcinus finds that comment and updates it instead of adding another. If the comment cannot be edited, it falls back to posting a new one rather than posting nothing. Two environments planning the same pull request each keep their own comment.
  • A status per environment. The status context is infraorcinus/plan/<environment>. Without that, environments sharing a repository would overwrite each other's status, and the last one to finish would decide whether the pull request could merge. If you have a branch-protection rule that requires the old name infraorcinus/plan, update it to the per-environment names you want to require.

4. Webhooks, Verified

Each organization has its own webhook URLs and secret, generated by an administrator in the GitOps settings and shown once. A delivery verified with one organization's secret can only trigger that organization's environments.

  • GitHub signs the payload with HMAC-SHA256, and the signature is verified before the payload is trusted.
  • Azure DevOps sends the secret as the Basic-authentication password on the request.

Subscribe the webhook to pull request and push events. The older installation-wide webhook URLs still exist but can trigger every organization's environments, so use the per-organization ones.


5. Credentials the Feedback Needs

Posting back needs a token from the VCS connection used by the environment's blueprint. Without one, the plan still runs and nothing is posted.

  • GitHub personal access token: works.
  • GitHub App connection (recommended): InfraOrcinus requests a short-lived installation token limited to that one repository and to Pull requests (write) and Commit statuses (write). Grant the app those two permissions.
  • Azure DevOps: a personal access token on the connection. Microsoft Entra sign-in is not supported for this yet.

The comment's link uses PUBLIC_BASE_URL, the absolute address of your InfraOrcinus. Leave it empty and the comment and status carry no link. If feedback cannot be posted, the server log says why.


6. Limits Today

  • A failed plan posts nothing yet. When a speculative plan fails outright, there is no comment or status. A green or red result appears only when the plan completes.
  • Only GitHub and Azure DevOps are supported for webhooks and feedback.
  • Existing duplicate comments stay. Deduplication applies to new plans; comments posted before it are not cleaned up.

Summary

A pull request is planned at its head commit, without applying anything, and the result comes back as one comment per environment, edited in place, plus a commit status per environment that branch protection can require. A merge reconciles the blueprint on the merged-pull-request event and starts exactly one run on the push, and webhooks are verified per organization. A plan that fails does not yet report back, which is the next gap to close.