Skip to content

Commit

Permalink
Merge branch 'drask' of github.com:nixsilvam404/space_station_ADT int…
Browse files Browse the repository at this point in the history
…o drask
  • Loading branch information
nixsilvam404 committed Jul 1, 2024
2 parents 146eb5d + 63b115b commit b6ead8d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/labeler-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
sync-labels: true
47 changes: 26 additions & 21 deletions Tools/ATD/auto_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,34 +91,38 @@ def fetch_pr_data(token, repo, pr_number):
def fetch_single_pr(number):
try:
pr_info = get_pr_info(token, repo, number)

# Проверяем, что PR был замержен
if not pr_info.get('merged_at'):
return None

body = pr_info.get('body', '')

# Находим строку, которая начинается с :cl:
author = pr_info['user']['login']
for line in body.splitlines():
if line.strip().startswith(':cl:'):
potential_author = line.strip()[4:].strip() # Убираем :cl: и пробелы
changes = []

lines = [line.strip() for line in body.splitlines()]
for line in lines:
if line.lower().startswith('no cl'):
return None

if line.startswith(':cl:'):
potential_author = line[4:].strip()
if potential_author:
author = potential_author
break
changes = []
for line in body.splitlines():
line = line.strip()
if line.startswith('- add:'):
changes.append({"message": line[len('- add:'):].strip(), "type": "Add"})
elif line.startswith('- remove:'):
changes.append({"message": line[len('- remove:'):].strip(), "type": "Remove"})
elif line.startswith('- tweak:'):
changes.append({"message": line[len('- tweak:'):].strip(), "type": "Tweak"})
elif line.startswith('- fix:'):
changes.append({"message": line[len('- fix:'):].strip(), "type": "Fix"})
continue

change_types = {
'- add:': "Add",
'- remove:': "Remove",
'- tweak:': "Tweak",
'- fix:': "Fix"
}

for prefix, change_type in change_types.items():
if line.startswith(prefix):
changes.append({"message": line[len(prefix):].strip(), "type": change_type})
break

if changes:
return {
"author": author,
Expand All @@ -127,6 +131,7 @@ def fetch_single_pr(number):
}
except requests.exceptions.RequestException as e:
logging.error(f"Failed to fetch PR #{number}: {e}")

return None

with ThreadPoolExecutor(max_workers=10) as executor:
Expand Down

0 comments on commit b6ead8d

Please sign in to comment.