in migration/src/random_agent.py [0:0]
def action(command: Command, new_issues_file: Path, token: str, repo: str) -> bool:
result = False
if command is Command.CREATE_ISSUE:
title = "Issue created by an agent"
body = "issue created"
res = create_issue(token, repo, title, body, logger)
if res:
(url, num) = res
with open(new_issues_file, "a") as fp:
fp.write(f"{url},{num}\n")
logger.debug(f"Issue created. {num}")
result = True
elif command is Command.UPDATE_ISSUE:
body = "issue updated"
issue_number = __select_random_issue(new_issues_file)
if update_issue_body(token, repo, issue_number, body, logger):
logger.debug(f"Issue updated. {issue_number}")
result = True
elif command is Command.CREATE_COMMENT:
body = "comment added"
issue_number = __select_random_issue(new_issues_file)
if create_comment(token, repo, issue_number, body, logger):
logger.debug(f"Comment added to {issue_number}.")
result = True
return result