Policy Approval
Define when a pull request is approved — combine the Hud Reviewer check with your other checks, paths, and authors — and enforce it as a required GitHub status.
Policy approval lets you define, per repository, what a pull request needs in order to be approved — for example "Hud says it's safe to merge and our security scan passed" — and have Hud enforce it on every PR.
Hud evaluates the policy each time the PR changes (new commits, reviews, labels, finished checks) and reports the result as a single GitHub commit status named Hud Approval Policy. Make that status required in your branch protection, and the policy becomes your merge gate.
Policy approval is based on the open-source policy-bot from Palantir, and uses the same policy.yml format. This page covers the basics; for the full list of rules, predicates, and options, see the policy-bot documentation.
Turn it on
- In Hud, go to Settings → Agentic Workflows and open the repository.
- Turn on Policy approval.
- Write your policy in the Hud policy editor and save (account admins only — other users see it read-only). Or, commit a
.policy.ymlto the repository instead (see Which policy applies). - In GitHub, make
Hud Approval Policya required status check. Go to the repository's Settings → Rules → Rulesets (or Settings → Branches for classic branch protection rules), edit the rule for your default branch, turn on Require status checks to pass, and addHud Approval Policy. See GitHub's guide to requiring status checks.
Writing a policy
A policy has two parts:
approval_rules— named rules. Each rule can have anifblock (when the rule applies — otherwise it's skipped) and arequiresblock (what must be true for it to be approved: reviews, passing checks, and so on).policy.approval— which rules must be approved. Listed rules must all pass; wrap them inor:/and:to combine them. Skipped rules are ignored.
Pick rule names that finish the sentence "This PR is approved if…" and keep them short — they show up in the status description on the PR.
Hud's own check appears on PRs as Hud Reviewer — that's the name to use in your policy.
Example 1: Hud + code review tool + security reviewer
Approve only when all three checks pass on the latest commit.
policy:
approval:
- all required checks passed
approval_rules:
- name: all required checks passed
requires:
conditions:
has_status:
conclusions: [success]
statuses:
- "Hud Reviewer"
- "static-code-analysis-cr-tool"
- "security-reviewer"Example 2: Hud approves, unless sensitive folders changed
Hud's check is enough on its own, unless the PR touches infra/, migrations/, or src/payments/. Then the Hud rule is skipped and a maintainer has to approve.
policy:
approval:
- or:
- hud passed and no sensitive paths
- a maintainer approved
approval_rules:
- name: hud passed and no sensitive paths
if:
no_changed_files:
paths:
- "^infra/"
- "^migrations/"
- "^src/payments/"
requires:
conditions:
has_status:
conclusions: [success]
statuses: [Hud Reviewer]
- name: a maintainer approved
requires:
count: 1
teams:
- "my-org/maintainers"paths are regular expressions matched against file paths from the repository root.
Example 3: Hud approves PRs from trusted authors
PRs opened by alice, bob, or carol only need Hud's check to pass. Everyone else needs one approving review from someone with write access.
policy:
approval:
- or:
- hud passed for a trusted author
- a reviewer approved
approval_rules:
- name: hud passed for a trusted author
if:
has_author_in:
users: ["alice", "bob", "carol"]
requires:
conditions:
has_status:
conclusions: [success]
statuses: [Hud Reviewer]
- name: a reviewer approved
requires:
count: 1
permissions: ["write"]has_author_in also accepts teams ("my-org/team") and organizations.
Always include a fallbackIn examples 2 and 3, the second rule is the path to approval when the Hud rule is skipped. Without it, those PRs would have no way to get approved.
Which policy applies
When more than one policy is defined for a repository, they take precedence in the following order (highest first):
- A policy file in the repository —
.policy.ymlat the root of the PR's base branch (it can also point to a policy in another repository withremote:). - An organization-wide policy —
policy.ymlat the root of your organization's.githubrepository. - The Hud policy from the Hud UI.
A policy file in GitHub overrides the Hud policyIf the repository has a
.policy.yml(or your organization has a shared.github/policy.yml), the policy you wrote in the Hud UI is not used for that repository. The Hud policy editor tells you when this is the case and which file wins. If that file can't be loaded, the PR reports the error — Hud does not fall back to the Hud policy.
Because the file is read from the base branch, edits to .policy.yml take effect only after they merge.
Good to know
- Status and check names must match exactly what GitHub shows on the PR. For GitHub Actions, that's the job name.
Hud Reviewercounts as passed only when Hud says "Safe to merge." "Review required" and "High risk" don't pass. PRs Hud doesn't analyze (not eligible, filtered out, or analysis failed) finish asneutral. To let those through, changeconclusionsto[success, neutral].- The Hud policy is validated when you save. If policy-bot rejects it, the errors are listed under the editor and nothing is saved. Very large policies are rejected too; removing comments usually fixes that.
- Saving the Hud policy re-evaluates open PRs, so their
Hud Approval Policystatus updates without a new push. - Turning off Policy approval stops status updates. If
Hud Approval Policyis still a required check, PRs can't merge until you remove the requirement or turn it back on. - Test a policy first. Try it on one repository, or add
Hud Approval Policyas a required check only after it has run on a few PRs.
Updated about 18 hours ago

