claude-configs/scripts/gitea-create-pr.sh
Cal Corum 047ec745eb Add new skills, commands, scripts; update Paper Dynasty workflows
New:
- backlog, cognitive-memory, optimise-claude skills
- commands/ and scripts/ directories
- usage-data tracking

Updated:
- Paper Dynasty: consolidated workflows, updated API client and CLI
- .gitignore, CLAUDE.md, settings.json

Removed:
- Deprecated Paper Dynasty workflows (card-refresh, database-sync,
  discord-app-troubleshooting, gauntlet-cleanup, custom-player-db)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:10:21 -06:00

73 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Gitea PR Creation Helper
# Creates pull requests on git.manticorum.com via API
#
# Usage:
# gitea-create-pr.sh <owner/repo> <head-branch> <base-branch> <title> [description]
#
# Example:
# gitea-create-pr.sh cal/major-domo-database fix/my-feature main "Fix: My feature" "Description here"
set -e
# Check arguments
if [ $# -lt 4 ]; then
echo "Usage: $0 <owner/repo> <head-branch> <base-branch> <title> [description]"
echo ""
echo "Example:"
echo " $0 cal/paper-dynasty fix/feature main 'Fix: Feature title' 'Optional description'"
exit 1
fi
REPO="$1"
HEAD_BRANCH="$2"
BASE_BRANCH="$3"
TITLE="$4"
DESCRIPTION="${5:-Automated PR created by Claude Code}"
# Load token
GITEA_TOKEN=$(cat /home/cal/.claude/secrets/gitea_token | tr -d '\n')
if [ -z "$GITEA_TOKEN" ]; then
echo "ERROR: Gitea token not found at /home/cal/.claude/secrets/gitea_token"
exit 1
fi
# Create PR via Gitea API
echo "Creating PR on https://git.manticorum.com/$REPO"
echo " Head: $HEAD_BRANCH"
echo " Base: $BASE_BRANCH"
echo " Title: $TITLE"
echo ""
RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
"https://git.manticorum.com/api/v1/repos/$REPO/pulls" \
-d @- <<EOF
{
"title": "$TITLE",
"head": "$HEAD_BRANCH",
"base": "$BASE_BRANCH",
"body": "$DESCRIPTION"
}
EOF
)
# Check for errors
if echo "$RESPONSE" | grep -q '"message"'; then
echo "ERROR: Failed to create PR"
echo "$RESPONSE" | jq -r '.message // .'
exit 1
fi
# Extract PR number and URL
PR_NUMBER=$(echo "$RESPONSE" | jq -r '.number')
PR_URL=$(echo "$RESPONSE" | jq -r '.html_url')
echo "PR created successfully!"
echo " Number: #$PR_NUMBER"
echo " URL: $PR_URL"
echo ""
echo "Gitea Actions will now run on this PR."