From 0101ae76d17a42531bb77f0a4a92813a92ac1634 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sat, 21 Sep 2024 18:37:59 -0700 Subject: [PATCH] refactor: Move comment_body to a global multiline string --- scripts/issues.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/issues.py b/scripts/issues.py index c4d0f8589..89f7bfaad 100755 --- a/scripts/issues.py +++ b/scripts/issues.py @@ -12,6 +12,10 @@ from tqdm import tqdm # Load environment variables from .env file load_dotenv() +DUPLICATE_COMMENT = """Thanks for trying aider and filing this issue. + +This looks like a duplicate of #{oldest_issue_number}, so I'm going to close it so discussion can happen there. Please let me know if you think it's actually a distinct issue.""" + # GitHub API configuration GITHUB_API_URL = "https://api.github.com" REPO_OWNER = "paul-gauthier" @@ -83,12 +87,7 @@ def comment_and_close_duplicate(issue, oldest_issue): ) close_url = f"{GITHUB_API_URL}/repos/{REPO_OWNER}/{REPO_NAME}/issues/{issue['number']}" - comment_body = ( - "Thanks for trying aider and filing this issue.\n\n" - f"This looks like a duplicate of #{oldest_issue['number']}, so I'm going to close it so" - " discussion can happen there. Please let me know if you think it's actually a distinct" - " issue." - ) + comment_body = DUPLICATE_COMMENT.format(oldest_issue_number=oldest_issue['number']) # Post comment response = requests.post(comment_url, headers=headers, json={"body": comment_body})