teqo-backup/.forgejo/workflows/agent-pool.yml
Francisco Solla f20305759a OPS50: port CI e scripts de agentes do GitHub para o Forgejo
Workflows nativos em .forgejo/workflows/ (ci, ci-pr, agent-pool,
automerge, issue-transition, plan-issue, vercel-promote, archive),
removendo .github/workflows e .github/actions. Runner Forgejo v13 com
services Postgres por porta + DB_HOST via gateway do bridge. Libs de
agente sobre o novo cliente forgejo-api.mjs (zero dependências,
GITHUB_SERVER_URL/FORGEJO_API_URL), helpers de workflow plain-Node.
pnpm issue corrigido (await em função sync) e validado ao vivo. Testes:
forgejoApi.unit.spec.ts novo, pin do matrix do ci.yml atualizado.

Closes #1 (parte 1 — docs/issues/pool seguem na parte 2)
2026-08-16 23:32:20 -03:00

69 lines
2.3 KiB
YAML

# Agent pool supervisor (docs/plans/agent-pool-orchestrator.md).
#
# Stateless tick: reconciles pool claims and spawns Cursor Cloud workers up to
# POOL_MAX_SLOTS over `ready` autonomous-eligible issues. Three triggers:
# - workflow_dispatch — the canonical human channel (start/stop/pause/resume)
# - schedule */10min — the periodic reconcile (default branch only)
# - pull_request closed on main — immediate slot replenish after a merge
#
# Secrets:
# CURSOR_API_KEY — Cursor Cloud Agents API key
# FORGEJO_API_TOKEN — optional PAT; the native GITHUB_TOKEN (full repo
# access) covers issue/label/contents ops inside Forgejo Actions
#
# Forgejo port (OPS50): no `concurrency:`/`permissions:` blocks; pool state
# lives in pool-state.json on the `pool-state` branch (variables API is
# GET-only here), read/written by scripts/lib/agent-pool-forgejo.mjs.
name: Agent pool supervisor
on:
schedule:
- cron: '*/10 * * * *'
pull_request:
types: [closed]
branches: [main]
workflow_dispatch:
inputs:
action:
description: 'Ação do pool'
required: true
type: choice
options:
- start
- stop
- pause
- resume
- tick
- status
maxSlots:
description: 'Slots simultâneos (só com action=start; default 5, máx 8)'
required: false
type: string
jobs:
tick:
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.event_name != 'pull_request' || github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v5
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: agent:pool workflow
env:
FORGEJO_API_TOKEN: ${{ secrets.FORGEJO_API_TOKEN }}
CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}
ACTION: ${{ inputs.action }}
MAX_SLOTS: ${{ inputs.maxSlots }}
run: |
if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then
args=(--action "$ACTION" --actor "$GITHUB_ACTOR")
if [ -n "$MAX_SLOTS" ]; then args+=(--max-slots "$MAX_SLOTS"); fi
else
args=(--action tick --actor "$GITHUB_ACTOR")
fi
node scripts/agent-pool.mjs workflow "${args[@]}"