From cf1e7178b57f96b9e7676cbdbc686b0893125747 Mon Sep 17 00:00:00 2001 From: Felix Faerber Date: Sat, 4 Jul 2026 23:32:12 +0300 Subject: [PATCH] fix(autopilot): merge with AGENT_TOKEN so the merge triggers the deploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qa's autopilot merge used the built-in Actions token (TOKEN_QA unset -> fell back to GITEA_TOKEN). Gitea does not fire new workflow runs for pushes made by the built-in Actions token, so the merge landed on main but deploy.yml never ran — the change was merged-but-not-deployed. Merge with AGENT_TOKEN (a PAT, already used for delegation and proven to trigger runs) so the push to main triggers the deploy. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/scripts/publish.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/scripts/publish.sh b/.gitea/workflows/scripts/publish.sh index fb2b265..29740fc 100755 --- a/.gitea/workflows/scripts/publish.sh +++ b/.gitea/workflows/scripts/publish.sh @@ -120,7 +120,13 @@ if [ "$MODE" != "pr" ]; then echo "MERGE_PR marker but this run is not on a PR thread — skipping merge" else echo "@qa autopilot: merging PR #$NUM (origin issue #${ISSNUM:-$NUM})" - mc=$(curl -sS -o /tmp/merge_resp.txt -w '%{http_code}' -X POST "${hdr[@]}" \ + # Merge with AGENT_TOKEN (a PAT) — NOT the built-in Actions token — so the resulting push to + # main TRIGGERS downstream workflows (e.g. deploy). A merge made with the built-in GITEA_TOKEN + # does not fire new runs (loop-prevention), which silently skips the deploy. Fall back to the + # agent's own token only if AGENT_TOKEN isn't set (then the deploy would need a manual run). + mtok="${AGENT_TOKEN:-$TOK}" + mc=$(curl -sS -o /tmp/merge_resp.txt -w '%{http_code}' -X POST \ + -H "Authorization: token $mtok" -H "Content-Type: application/json" \ "$API/pulls/$NUM/merge" -d '{"Do":"merge"}') echo "merge -> HTTP $mc"; cat /tmp/merge_resp.txt 2>/dev/null || true case "$mc" in