teqo/.forgejo/workflows/agent-pr-ready-automerge.yml
Francisco Solla 87a81c29fd
All checks were successful
CI (PR) / scope (pull_request) Successful in 41s
PR Ready + auto-merge / ready-automerge (pull_request) Successful in 1m20s
CI (PR) / docs-guards (pull_request) Successful in 10s
CI (PR) / plans-only-closes (pull_request) Successful in 9s
CI (PR) / typecheck (pull_request) Has been skipped
CI (PR) / knip (pull_request) Has been skipped
CI (PR) / cycles (pull_request) Has been skipped
CI (PR) / unit (pull_request) Has been skipped
Main merge flips claimed issues to done + in-prod / issue-done (pull_request) Successful in 16s
Promote plan-issue Related on main merge / plan-issue-ready (pull_request) Has been skipped
CI (PR) / lint (pull_request) Successful in 1m5s
Agent pool supervisor / tick (pull_request) Successful in 43s
CI (PR) / format (pull_request) Successful in 1m19s
CI / static (push) Successful in 3m39s
CI / int (push) Successful in 3m57s
CI (PR) / int (pull_request) Has been skipped
CI (PR) / build (pull_request) Has been skipped
CI (PR) / e2e (1) (pull_request) Has been skipped
CI (PR) / e2e (2) (pull_request) Has been skipped
CI (PR) / checks (pull_request) Successful in 2s
CI / build (push) Successful in 5m14s
CI / e2e (1) (push) Successful in 7m58s
CI / e2e (2) (push) Successful in 6m27s
CI / checks (push) Successful in 2s
CI / deploy homeserver (teqo-1313) (push) Successful in 4m44s
chore(ops OPS57): alargar o gatilho do forgejo-pr-automerge para todas as PRs same-repo (draft não-cursor/* = veto)
2026-08-18 11:50:48 -03:00

41 lines
1.9 KiB
YAML

# Safety net: every same-repo PR to main must be Ready + auto-merge.
# Covers Cloud ManagePullRequest defaulting to draft, agents that forget to
# arm the merge, and human/worktree PRs (the OPS52 incident was a human PR
# whose merge failed silently). Draft PRs from non-`cursor/*` branches are
# never touched — the draft flag is the actor's veto (the CLI skips them).
# Fork PRs are excluded (the repo is public; a merged fork PR would deploy).
#
# Forgejo port (OPS50): Forgejo's API has no auto-merge scheduling, so the
# workflow runs scripts/forgejo-pr-automerge.mjs (plain Node): marks draft →
# ready, waits for the commit statuses (the branch-protection `checks` gate),
# then merges by rebase. Same semantics as `gh pr merge --auto --rebase`,
# implemented as poll + merge. GitHub's cancel-workflow-on-failure action was
# dropped (no GITHUB_RUN_ID plumbing on Forgejo).
name: PR Ready + auto-merge
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]
branches: [main]
jobs:
ready-automerge:
# Same-repo only: a fork PR merged here would push attacker code to main
# (and deploy to production). The draft policy lives in the CLI (skips
# non-`cursor/*` drafts) so it reads the PR state from the API, not from
# webhook payload fields.
if: >-
github.event.pull_request.state == 'open' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v5
# Script is plain Node (stdlib) — no pnpm. Disable package-manager-cache:
# setup-node@v5 defaults to true and looks for pnpm before pnpm/action-setup.
- uses: actions/setup-node@v5
with:
node-version: 24
package-manager-cache: false
- name: Mark Ready and merge when checks pass
run: node scripts/forgejo-pr-automerge.mjs --pr "${{ github.event.pull_request.number }}"