Archive: - docker-compose.yml, Dockerfile.playwright - scripts/ (legacy test scripts) - docs/, .test/ (old documentation and tests) - IMPROVEMENT_PROPOSAL.md (superseded by .kilo/) - BROWSER_VISIBILITY.md, README.Docker.md - cleanup-packages.sh, fix-permissions.sh, install-apaw.sh Keep in root: - .kilo/ (active system) - .claude/ (Claude Code runtime) - AGENTS.md (agent reference) - README.md (main documentation) - src/ (utility code) - package.json, tsconfig.json (project config)
66 lines
1.8 KiB
Bash
66 lines
1.8 KiB
Bash
#!/bin/bash
|
|
# Create Gitea API token using Basic Auth
|
|
# Usage: ./scripts/create-gitea-token.sh <username> <password>
|
|
|
|
API_URL="https://git.softuniq.eu/api/v1"
|
|
|
|
if [ -z "$1" ] || [ -z "$2" ]; then
|
|
echo "Usage: $0 <username> <password>"
|
|
echo ""
|
|
echo "Example: $0 NW mypassword"
|
|
echo ""
|
|
echo "This will create a new API token for the user."
|
|
exit 1
|
|
fi
|
|
|
|
USERNAME="$1"
|
|
PASSWORD="$2"
|
|
TOKEN_NAME="Pipeline Test $(date +%Y%m%d%H%M%S)"
|
|
|
|
echo "=== Gitea Token Creation ==="
|
|
echo ""
|
|
echo "👤 Username: $USERNAME"
|
|
echo "🔑 Token name: $TOKEN_NAME"
|
|
echo ""
|
|
|
|
# Create token using Basic Auth
|
|
echo "🔐 Creating token..."
|
|
RESPONSE=$(curl -s -X POST \
|
|
-u "$USERNAME:$PASSWORD" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"name\":\"$TOKEN_NAME\",\"scopes\":[\"all\"]}" \
|
|
"$API_URL/users/$USERNAME/tokens")
|
|
|
|
# Check for error
|
|
if echo "$RESPONSE" | grep -q '"message"'; then
|
|
ERROR=$(echo "$RESPONSE" | sed 's/.*"message":"\([^"]*\)".*/\1/')
|
|
echo "❌ Failed to create token: $ERROR"
|
|
echo ""
|
|
echo "Response: $RESPONSE"
|
|
exit 1
|
|
fi
|
|
|
|
# Extract token
|
|
TOKEN=$(echo "$RESPONSE" | sed 's/.*"sha1":"\([^"]*\)".*/\1/' | head -1)
|
|
TOKEN_ID=$(echo "$RESPONSE" | sed 's/.*"id":\([0-9]*\).*/\1/' | head -1)
|
|
|
|
if [ -n "$TOKEN" ] && [ ${#TOKEN} -gt 10 ]; then
|
|
echo "✅ Token created successfully!"
|
|
echo ""
|
|
echo "📋 Token details:"
|
|
echo " ID: $TOKEN_ID"
|
|
echo " Name: $TOKEN_NAME"
|
|
echo " Token: $TOKEN"
|
|
echo ""
|
|
echo "💡 Save this token for future use:"
|
|
echo ""
|
|
echo " export GITEA_TOKEN=$TOKEN"
|
|
echo ""
|
|
echo " # Add to ~/.bashrc for persistence:"
|
|
echo " echo 'export GITEA_TOKEN=$TOKEN' >> ~/.bashrc"
|
|
echo ""
|
|
else
|
|
echo "❌ Failed to extract token from response"
|
|
echo "Response: $RESPONSE"
|
|
exit 1
|
|
fi |