Compare commits

...

3 Commits

Author SHA1 Message Date
9dfbc5efa4 Enable multi-api-key secrets
Some checks failed
Run Python tests (through Pytest) / Test (push) Failing after 24s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 22s
2025-04-15 23:27:55 +02:00
f28df768e7 Re-enable Aider now that system is usable again 2025-04-15 23:25:26 +02:00
d03a8aa9df Disable labels for nwo 2025-04-15 23:19:57 +02:00
3 changed files with 20 additions and 13 deletions

View File

@ -155,15 +155,16 @@ def create_aider_command(issue: str) -> list[str]:
AIDER_LINT,
'--auto-test',
'--no-auto-lint',
'--api-key',
secrets.llm_api_key(),
'--read',
'CONVENTIONS.md',
'--message',
LLM_MESSAGE_FORMAT.format(issue=issue),
'--yes-always',
'--yes',
]
for key in secrets.llm_api_keys():
l += ['--api-key', key]
if True:
l.append('--cache-prompts')
@ -282,6 +283,7 @@ def run_cmd(cmd: list[str], cwd: Path | None = None, check=True) -> bool:
result = subprocess.run(cmd, check=check, cwd=cwd)
return result.returncode == 0
SKIP_AIDER = False
def solve_issue_in_repository(
args,
@ -292,6 +294,8 @@ def solve_issue_in_repository(
issue_number: str,
gitea_client=None,
) -> bool:
logger.info("### %s #####", issue_title)
repo_url = f'{args.gitea_url}:{args.owner}/{args.repo}.git'.replace(
'https://',
'git@',
@ -320,11 +324,15 @@ def solve_issue_in_repository(
# Run aider
issue_content = f'# {issue_title}\n{issue_description}'
if not SKIP_AIDER:
succeeded = run_cmd(
create_aider_command(issue_content),
tmpdirname,
check=False,
)
else:
logger.warning("Skipping aider command (for testing)")
succeeded = True
if not succeeded:
logger.error('Aider invocation failed for issue #%s', issue_number)
return False
@ -344,7 +352,7 @@ def solve_issue_in_repository(
)
files_changed = result.stdout.strip()
if not files_changed:
if not files_changed and not SKIP_AIDER:
logger.info(
'Aider did not make any changes beyond the initial ruff pass for issue #%s',
issue_number,

View File

@ -163,7 +163,6 @@ class GiteaClient:
'body': body,
'head': head,
'base': base,
'labels': labels,
}
response = self.session.post(url, json=json_data)

View File

@ -3,9 +3,9 @@ import secret_loader
SECRETS = secret_loader.SecretLoader()
def llm_api_key():
return SECRETS.load_or_fail('LLM_API_KEY')
def llm_api_keys() -> list[str]:
return SECRETS.load_or_fail('LLM_API_KEY').strip().split('\n')
def gitea_token():
def gitea_token() -> str:
return SECRETS.load_or_fail('GITEA_TOKEN')