apifix1/scripts/run_workflow.sh

36 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Run the preparation script and capture its output and exit code
echo "Step 1: Running preparation script..."
output=$(python3 -u src/dependency_upgrade_workflow_simple.py | tee /dev/tty)
echo "-------------------------------------------------"
echo "First step finished."
# Check the exit code of the python script
# Note: This part is tricky with pipe. A better way is to use temporary file for output.
# However, for this case, we can rely on the output message.
if echo "$output" | grep -q "没有可升级的依赖项或没有选择要升级的依赖项"; then
echo "No dependencies to upgrade. Skipping repair step."
exit 0
fi
if ! echo "$output" | grep -q "工作流程完成!"; then
echo "Preparation script failed. Aborting."
exit 1
fi
# Extract project name from the output
PROJECT_NAME=$(echo "$output" | grep "项目名称:" | awk -F ": " '{print $2}')
# Check if project name was extracted
if [ -z "$PROJECT_NAME" ]; then
echo "Error: Could not determine project name. Aborting."
exit 1
fi
echo "Step 2: Running the agent for project: $PROJECT_NAME..."
cd src/agent
python3 main.py "$PROJECT_NAME"
echo "Workflow finished."