From 9198664a2dd3d10f19951c053b6a96d171ef5d44 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 18 Mar 2026 23:30:38 -0500 Subject: [PATCH 1/2] docs: add CI/CD section to CLAUDE.md Test commit for auto-merge-docs workflow validation. Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 9487024..fc10341 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,3 +17,6 @@ load the relevant dev CONTEXT: `.py` → `development/python-CONTEXT.md`, - New tech without a directory → offer to create `/{tech}/` structure - New error solved → offer to add to `{tech}/troubleshooting.md` - New scripts created → offer to update `{tech}/scripts/CONTEXT.md` + +## CI/CD +- Docs-only PRs (all `.md` files) are auto-approved and merged by the `auto-merge-docs` workflow From 1cfa56194aac2763a0156433a06f08df278b58ea Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 18 Mar 2026 23:32:05 -0500 Subject: [PATCH 2/2] ci: fix auto-merge token and add error logging Switch to github.token, add verbose merge error output, and fallback to rebase merge strategy if standard merge fails. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/auto-merge-docs.yml | 31 +++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/auto-merge-docs.yml b/.gitea/workflows/auto-merge-docs.yml index 8c72489..14ecd76 100644 --- a/.gitea/workflows/auto-merge-docs.yml +++ b/.gitea/workflows/auto-merge-docs.yml @@ -12,7 +12,7 @@ jobs: - name: Check if all changes are markdown id: check env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + GITEA_TOKEN: ${{ github.token }} run: | PR_NUMBER=${{ github.event.pull_request.number }} API_URL="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${PR_NUMBER}/files" @@ -42,21 +42,42 @@ jobs: - name: Approve and merge if: steps.check.outputs.docs_only == 'true' env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + GITEA_TOKEN: ${{ github.token }} run: | PR_NUMBER=${{ github.event.pull_request.number }} API_BASE="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${PR_NUMBER}" # Approve the PR - curl -sf -X POST "${API_BASE}/reviews" \ + curl -s -X POST "${API_BASE}/reviews" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d '{"event": "APPROVED", "body": "Auto-approved: docs-only changes (all .md files)."}' + echo "Attempting merge..." + # Merge the PR - curl -sf -X POST "${API_BASE}/merge" \ + MERGE_RESPONSE=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X POST "${API_BASE}/merge" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ - -d '{"Do": "merge", "merge_message_field": "Auto-merge: docs-only PR #'"${PR_NUMBER}"'"}' + -d '{"Do": "merge", "merge_message_field": "Auto-merge: docs-only PR #'"${PR_NUMBER}"'"}') + + HTTP_STATUS=$(echo "$MERGE_RESPONSE" | tail -1 | sed 's/HTTP_STATUS://') + BODY=$(echo "$MERGE_RESPONSE" | sed '$d') + + echo "Merge response (HTTP ${HTTP_STATUS}):" + echo "$BODY" + + if [ "$HTTP_STATUS" -ge 400 ]; then + echo "Merge failed, retrying with rebase strategy..." + MERGE_RESPONSE=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X POST "${API_BASE}/merge" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d '{"Do": "rebase"}') + HTTP_STATUS=$(echo "$MERGE_RESPONSE" | tail -1 | sed 's/HTTP_STATUS://') + BODY=$(echo "$MERGE_RESPONSE" | sed '$d') + echo "Rebase response (HTTP ${HTTP_STATUS}):" + echo "$BODY" + [ "$HTTP_STATUS" -ge 400 ] && exit 1 + fi echo "PR #${PR_NUMBER} auto-approved and merged."