Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse AZDO PR's numbers with enabled auto-complete #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/repositories/azdo_git_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT License.

import os
import re
import json
import requests
import utils
Expand Down Expand Up @@ -123,12 +124,16 @@ def get_commit_message(self, commit_id):

def get_pr_num(self, commit_id) -> str:
comment = self.get_commit_message(commit_id)
MERGED_PR = "Merged PR "
pr_num = None
if MERGED_PR in comment:
merged_pr_index = comment.index(MERGED_PR)
pr_num = comment[merged_pr_index + len(MERGED_PR): comment.index(":", merged_pr_index)]
return pr_num
# Regex pattern to match "Merged PR <number>" or "Merge pull request <number>"
pattern = r'Merged PR (\d+)|Merge pull request (\d+)'

match = re.search(pattern, comment)
if match:
# Group 1 is for "Merged PR", Group 2 is for "Merge pull request"
pr_num = match.group(1) or match.group(2)
return pr_num

return ""

def is_commit_finished(self, commit_id):
return False
Loading