From 1eda939de6c079f74963b26294e37c823e291905 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 18 Mar 2026 23:33:25 -0500 Subject: [PATCH 1/2] docs: add Gitea CI/CD link to server-configs README Co-Authored-By: Claude Opus 4.6 --- server-configs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/server-configs/README.md b/server-configs/README.md index 2729efb..9692ada 100644 --- a/server-configs/README.md +++ b/server-configs/README.md @@ -242,3 +242,4 @@ To restore a VM/LXC config: - [Tdarr Setup](../tdarr/CONTEXT.md) - Media transcoding configuration - [Networking](../networking/CONTEXT.md) - NPM and network config - [Monitoring](../monitoring/CONTEXT.md) - System monitoring setup +- [Gitea CI/CD](gitea/INDEX.md) - Gitea Actions and workflow templates From 6bc95b56795c9dc6d3af7a8ee0642be7a37b4ea0 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 18 Mar 2026 23:37:07 -0500 Subject: [PATCH 2/2] ci: use AUTO_MERGE_TOKEN secret for docs auto-merge The built-in github.token lacks write permission to push to main. Use a dedicated token stored as a repo secret instead. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/auto-merge-docs.yml | 31 +++++----------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/.gitea/workflows/auto-merge-docs.yml b/.gitea/workflows/auto-merge-docs.yml index 14ecd76..8d73e95 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: ${{ github.token }} + GITEA_TOKEN: ${{ secrets.AUTO_MERGE_TOKEN }} run: | PR_NUMBER=${{ github.event.pull_request.number }} API_URL="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${PR_NUMBER}/files" @@ -42,42 +42,21 @@ jobs: - name: Approve and merge if: steps.check.outputs.docs_only == 'true' env: - GITEA_TOKEN: ${{ github.token }} + GITEA_TOKEN: ${{ secrets.AUTO_MERGE_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 -s -X POST "${API_BASE}/reviews" \ + curl -sf -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 - MERGE_RESPONSE=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X POST "${API_BASE}/merge" \ + curl -sf -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}"'"}') - - 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 + -d '{"Do": "merge", "merge_message_field": "Auto-merge: docs-only PR #'"${PR_NUMBER}"'"}' echo "PR #${PR_NUMBER} auto-approved and merged."