mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 23:25:18 +00:00
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)
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
/**
|
|
* One-time / drift repair for branch protection (main-only) — Forgejo.
|
|
*
|
|
* pnpm configure:branch-protection # apply
|
|
* pnpm configure:branch-protection -- --dry-run
|
|
*
|
|
* main: required status checks `checks`, strict=false, 0 reviews.
|
|
* Feature PRs auto-merge when that context is green.
|
|
* (migration-lock removed 2026-08-12 — see ci-pr.yml header.)
|
|
*/
|
|
|
|
import { parseArgs } from './lib/agent-forgejo.mjs'
|
|
import { createApi } from './lib/forgejo-api.mjs'
|
|
|
|
const { flags } = parseArgs(process.argv.slice(2), new Set())
|
|
const dryRun = flags['dry-run'] === true
|
|
|
|
const api = createApi({})
|
|
const repo = process.env.FORGEJO_REPOSITORY ?? process.env.GITHUB_REPOSITORY ?? 'fsolla/teqo'
|
|
|
|
const payload = {
|
|
rule_name: 'main',
|
|
enable_status_check: true,
|
|
status_check_contexts: ['checks'],
|
|
enable_push: false,
|
|
required_approvals: 0,
|
|
dismiss_stale_approvals: false,
|
|
}
|
|
|
|
console.log(`[configure:branch-protection] repo ${repo}${dryRun ? ' (dry-run)' : ''}`)
|
|
|
|
if (dryRun) {
|
|
console.log(`[dry-run] POST /repos/${repo}/branch_protections ${JSON.stringify(payload)}`)
|
|
process.exit(0)
|
|
}
|
|
|
|
await api.updateBranchProtection('main', payload)
|
|
console.log('[configure:branch-protection] done (main: checks, strict=false, 0 reviews).')
|