fix: resolve merge conflicts in ticket_whitelist, add retry logic for port 5001 in bug_report, and implement live GitLab issue deduplication in logger
This commit is contained in:
parent
c40c3f1f12
commit
16263d88bc
6 changed files with 525 additions and 54 deletions
|
|
@ -63,6 +63,35 @@ class GitLabClient:
|
|||
gitlab_internal_logger.error(f"❌ Error connecting to GitLab API: {e}")
|
||||
return None
|
||||
|
||||
async def find_issue_by_title(self, title: str, state: str = "opened") -> Optional[dict]:
|
||||
"""
|
||||
Searches for an issue by its exact title and state.
|
||||
"""
|
||||
if not self.token or not self.project_id:
|
||||
return None
|
||||
|
||||
headers = {"PRIVATE-TOKEN": self.token}
|
||||
params = {
|
||||
"search": title,
|
||||
"state": state
|
||||
}
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
try:
|
||||
# search param is fuzzy on GitLab, so we must double-check for exact match
|
||||
async with session.get(self.api_url, headers=headers, params=params) as response:
|
||||
if response.status == 200:
|
||||
issues = await response.json()
|
||||
for issue in issues:
|
||||
if issue.get("title") == title:
|
||||
return issue
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
except Exception as e:
|
||||
gitlab_internal_logger.error(f"❌ Error searching GitLab issues: {e}")
|
||||
return None
|
||||
|
||||
async def get_closed_issues(self) -> List[dict]:
|
||||
"""
|
||||
Fetches recently closed issues.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue