refactor: Move comment_body to a global multiline string

This commit is contained in:
Paul Gauthier (aider) 2024-09-21 18:37:59 -07:00
parent 26f9a10324
commit 0101ae76d1

View file

@ -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})