change to check for only staged changes

pull/5227/head
SwiftyOS 2023-09-15 20:10:51 +02:00
parent 71cb72b3a4
commit 433526b732
1 changed files with 10 additions and 8 deletions

18
cli.py
View File

@ -399,13 +399,14 @@ def enter(agent_name, branch):
click.echo(click.style(f"⚠️ The agent '{agent_name}' has already entered the arena. Use './run arena submit' to update your submission.", fg='yellow'))
return
# Check if there are staged or unstaged changes
changes = subprocess.check_output(['git', 'status', '--porcelain']).decode('utf-8').strip()
if changes:
click.echo(click.style(f"❌ There are staged or unstaged changes. Please commit or unstage them and run the command again.", fg='red'))
# Check if there are staged changes
staged_changes = [line for line in subprocess.check_output(['git', 'status', '--porcelain']).decode('utf-8').split('\n') if line and line[0] in ('A', 'M', 'D', 'R', 'C')]
if staged_changes:
click.echo(click.style(f"❌ There are staged changes. Please commit or stash them and run the command again.", fg='red'))
return
try:
# Load GitHub access token from file
with open('.github_access_token', 'r') as file:
@ -500,12 +501,13 @@ def submit(agent_name, branch):
click.echo(click.style(f"❌ The agent '{agent_name}' has not yet entered the arena. Please enter the arena with './run arena enter'", fg='red'))
return
# Check if there are staged or unstaged changes
changes = subprocess.check_output(['git', 'status', '--porcelain']).decode('utf-8').strip()
if changes:
click.echo(click.style(f"❌ There are staged or unstaged changes. Please commit or unstage them and run the command again.", fg='red'))
# Check if there are staged changes
staged_changes = [line for line in subprocess.check_output(['git', 'status', '--porcelain']).decode('utf-8').split('\n') if line and line[0] in ('A', 'M', 'D', 'R', 'C')]
if staged_changes:
click.echo(click.style(f"❌ There are staged changes. Please commit or stash them and run the command again.", fg='red'))
return
try:
# Load GitHub access token from file