Files
code-server 1b920d7299 fix: prevent branch collision in test-pr.sh
Use + refspec to force update pr-N branch on re-run. Prevents
'already exists' error when testing the same PR multiple times.

Addresses review feedback from PR #32.
2026-03-09 12:20:25 +01:00

35 lines
942 B
Bash
Executable File

#!/bin/bash
# test-pr.sh - Quick PR testing script for nanobot staging
#
# Usage: ./test-pr.sh <pr-number> [test-message]
# Example: ./test-pr.sh 31 "test tool use feature"
set -e
PR_NUM="$1"
TEST_MSG="${2:-Hello, testing PR #$PR_NUM}"
REPO_DIR="/config/workspace/nanobot-oauth-port/nanobot-fork"
STAGING_CONFIG="/config/workspace/.nanobot-staging/config.json"
if [ -z "$PR_NUM" ]; then
echo "Usage: $0 <pr-number> [test-message]"
exit 1
fi
echo "==> Fetching PR #$PR_NUM..."
cd "$REPO_DIR"
git fetch wylab "+pull/$PR_NUM/head:pr-$PR_NUM"
echo "==> Checking out pr-$PR_NUM..."
git checkout "pr-$PR_NUM"
echo "==> Installing in editable mode..."
uv pip install -e . -q
echo "==> Testing with message: $TEST_MSG"
NANOBOT_CONFIG="$STAGING_CONFIG" "$REPO_DIR/.venv/bin/nanobot" agent -m "$TEST_MSG"
echo ""
echo "==> Test complete. Branch pr-$PR_NUM is still checked out."
echo " Run 'git checkout main' to return to main branch."