WORKFLOW · deterministic-policy
Required checks for agent PRs
A GitHub Actions workflow exposing four named status checks, plus the ruleset configuration that requires them on every PR, agent-authored or human.
✓ verified 2026-06-10 · stack: github-actions, java, gradle · source
The outer deterministic gate: four named status checks on every pull request, required by a ruleset with no bypass actors. The point is symmetry: an agent PR merges on exactly the same evidence as a human PR.
name: Agent PR Gateson: pull_request: branches: [main, develop]
jobs: build-and-test: name: Build and Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: '21' distribution: 'temurin' cache: 'gradle' - name: Build run: ./gradlew build --no-daemon - name: Unit Tests run: ./gradlew test --no-daemon
spotless-check: name: Spotless Format Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: '21' distribution: 'temurin' cache: 'gradle' - run: ./gradlew spotlessCheck --no-daemon
security-scan: name: OWASP Dependency Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: '21' distribution: 'temurin' cache: 'gradle' - run: ./gradlew dependencyCheckAnalyze --no-daemon
validate-no-secrets: name: Secret Scan runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: gitleaks/gitleaks-action@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Then create a ruleset (repository settings → Rules → Rulesets, or org level to
cover many repos) targeting main and develop with:
- Require status checks to pass: add the four check names exactly as the
jobs declare them:
Build and Test,Spotless Format Check,OWASP Dependency Check,Secret Scan. Loose mode (branch need not be up to date) is the usual default; strict for deployment branches. - Require a pull request before merging, with stale approvals dismissed on new commits.
- Require review from code owners, and maintain a CODEOWNERS file
covering
pom.xml/build.gradle*,terraform/,.github/workflows/, productionapplication*.yml, and.claude/(the worked CODEOWNERS file is in CI as the outer gate). - Block force pushes.
- Bypass list: empty for the status-check rules. If a bot identity needs to merge unattended, grant its GitHub App bypass of the review-count requirement only, never of the status checks, and keep CODEOWNERS paths human-gated regardless.
What it does
- Exposes each gate as a separately named check, so the ruleset can require
them individually and a failure is legible at a glance (an agent PR failing
Secret Scanreads very differently from one failingUnit Tests). - Catches the characteristic agent failure modes: formatting drift (Spotless), unvetted dependency additions (OWASP), and committed credentials (gitleaks), with full history depth so gitleaks scans every commit on the branch, not just the tip.
- Because rulesets aggregate most-restrictively with other rulesets and any legacy branch protection, this layers safely on top of whatever the org already enforces.
Failure modes
- Check names are a contract. Renaming a
name:in the workflow silently decouples it from the ruleset: the old required check simply never reports, and PRs hang. Change both together. - A workflow in the PR can shadow a check name. Unless you restrict the
required check’s source to a specific GitHub App, a malicious PR can define
a trivially green job with the same name. Set the check source where the
integration reporting it supports
statuses:write. dependencyCheckAnalyzeassumes the OWASP plugin is configured in your Gradle build (and benefits from an NVD API key for sane runtimes). Swap in your scanner of choice; keep the named-check structure.- Gitleaks licensing:
gitleaks-action@v2requires a licence key for organisation accounts. Budget for it or substitute an equivalent scanner.
Verified against the GitHub rulesets documentation (available rules, creating rulesets), 2026-06-10.