mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-15 01:55:18 +00:00
Decisão (2026-08-21): o GitHub passa a ser a fonte única — main, branches, PRs, CI via Actions E tracker de Issues. O Forgejo deixa de ser canal ativo (git.e issue tracker congelados pós-convergência). Data: 17 issues migradas do Forgejo para o GitHub (frontmatter id/depends/ serializes/priority/model preservados, labels mapeados, comment de origem em cada uma; tabela Forgejo→GitHub registrada). Tooling: github-api.mjs estendido com a camada de issues/labels/comments/ close/workflow-dispatch/contents (mesmo shape normalizado do forgejo-api); 18 scripts trocam o transporte forgejo-api → github-api; forgejo-api.mjs e seu teste (961 linhas) removidos; teste githubApi.unit.spec.ts novo (7 casos); issue-transition-on-merge.mjs renomeado e reapontado. Flips pós-merge: issue-done e plan-issue-ready agora usam o GITHUB_TOKEN com issues:write no repo (sem FORGEJO_API_TOKEN) e fecham/flipam Issues no GitHub. Docs: AGENTS.md, AGENT-OPS.md e skills do fluxo vivo (work-issue, plan-issue, project-status, capture-review-debts, worktree-next-issue, agent-work-issue) apontam o tracker para github.com/fsolla/teqo/issues. Gates: tsc/lint/format/knip/cycles/unit 2416 verdes.
86 lines
3.9 KiB
YAML
86 lines
3.9 KiB
YAML
# Safety net OPS18: when a PR merges to main with `Related #N`, promote Issues
|
|
# that are still awaiting their intention plan (`blocked` + docs/plans/ link)
|
|
# to `ready`. Idempotent with `pnpm agent:ready` (agent happy path). OPS76:
|
|
# the PR and the issues live on GitHub — the job passes the PR body via PR_BODY
|
|
# and scripts/agent-promote-related-on-merge.mjs flips labels on the GitHub API
|
|
# (repo GITHUB_TOKEN, `issues: write`).
|
|
#
|
|
# Does NOT run on open PRs — only after merge — so the claim race stays closed.
|
|
# Job is gated on Related # in the body so non-plan merges skip checkout/Node.
|
|
# Fork guard: on a merged fork PR the checkout pulls the fork's own script,
|
|
# which would run with the repo PAT (RCE — same class as
|
|
# agent-pr-ready-automerge.yml).
|
|
#
|
|
# OPS71-FLIP: `workflow_dispatch` is the MANUAL recovery path — the `closed`
|
|
# event does NOT create a run when the merge was performed by
|
|
# github-actions[bot] (auto-merge armed with the built-in GITHUB_TOKEN;
|
|
# GitHub's anti-recursion, live finding PR #746). Dispatch with the PR number:
|
|
# the job fetches the PR via `gh` (same contract: merged + base main +
|
|
# same-repo) and runs the same promotion.
|
|
name: Promote plan-issue Related on main merge
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
inputs:
|
|
pr:
|
|
description: 'PR number (manual recovery when the closed event did not create a run)'
|
|
required: true
|
|
type: number
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
issues: write
|
|
|
|
jobs:
|
|
plan-issue-ready:
|
|
if: >-
|
|
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.head.repo.full_name == github.repository && (contains(github.event.pull_request.body, 'Related #') || contains(github.event.pull_request.body, 'related #') || contains(github.event.pull_request.body, 'RELATED #'))) ||
|
|
(github.event_name == 'workflow_dispatch' && inputs.pr != '')
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
env:
|
|
# The github-api.mjs client reads GITHUB_TOKEN; the built-in token has
|
|
# `issues: write` scoped to this repo (the tracker is on GitHub).
|
|
GH_TOKEN: ${{ github.token }}
|
|
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 (packageManager in package.json) before pnpm/action-setup.
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
- name: Fetch PR metadata (manual recovery — bot auto-merges skip the closed event)
|
|
if: github.event_name == 'workflow_dispatch'
|
|
id: pr
|
|
run: |
|
|
PR="${{ inputs.pr }}"
|
|
STATE="$(gh pr view "$PR" --json state -q .state)"
|
|
if [ "$STATE" != "MERGED" ]; then
|
|
echo "PR #$PR não mergeada (state=$STATE) — skip"
|
|
exit 0
|
|
fi
|
|
BASE="$(gh pr view "$PR" --json baseRefName -q .baseRefName)"
|
|
REPO="$(gh pr view "$PR" --json headRepository -q .headRepository.nameWithOwner)"
|
|
if [ "$BASE" != "main" ] || [ "$REPO" != "${{ github.repository }}" ]; then
|
|
echo "PR #$PR fora do contrato (base=$BASE repo=$REPO — precisa main + same-repo) — skip"
|
|
exit 0
|
|
fi
|
|
BODY="$(gh pr view "$PR" --json body -q .body)"
|
|
{
|
|
echo "valid=true"
|
|
echo "pr_number=$PR"
|
|
echo "pr_body<<EOF"
|
|
echo "$BODY"
|
|
echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
- name: Promote Related #N awaiting plan → ready
|
|
if: steps.pr.outputs.valid == 'true' || github.event_name == 'pull_request'
|
|
env:
|
|
PR_BODY: ${{ steps.pr.outputs.pr_body || github.event.pull_request.body }}
|
|
run: node scripts/agent-promote-related-on-merge.mjs --pr "${{ steps.pr.outputs.pr_number || github.event.pull_request.number }}"
|