Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
820d68d
Enhance cherry-pick script with support for unmerged PRs and improved…
naspirato Nov 18, 2025
109c4ce
Enhance cherry-pick script with changelog extraction and improved PR …
naspirato Nov 18, 2025
57d548e
Enhance cherry-pick script to avoid branch name conflicts and improve…
naspirato Nov 18, 2025
7c39046
Enhance cherry-pick script to include detailed conflict resolution in…
naspirato Nov 18, 2025
4c9fad3
Add PR template and category definitions for validation
naspirato Nov 18, 2025
6abc803
Enhance cherry-pick script with improved error handling and conflict …
naspirato Nov 18, 2025
f1ffacf
Enhance cherry-pick script with improved conflict handling and logging
naspirato Nov 18, 2025
54cf67f
Refactor changelog extraction in cherry-pick script
naspirato Nov 18, 2025
b4b3ba2
Enhance cherry-pick script with improved diff link generation
naspirato Nov 18, 2025
381d617
Enhance cherry-pick script with improved backport comment management
naspirato Nov 18, 2025
3e4a4fb
Refactor cherry-pick script for improved PR validation and changelog …
naspirato Nov 18, 2025
30583a3
Update cherry-pick script to change cherry-pick command options
naspirato Nov 18, 2025
b3c135c
Refactor cherry-pick command in script to simplify handling of empty …
naspirato Nov 18, 2025
8c7ac30
Refactor cherry-pick script to streamline commit existence checks and…
naspirato Nov 18, 2025
6a8bb9f
Enhance cherry-pick script to improve conflict message handling and l…
naspirato Nov 18, 2025
4e03d14
Enhance cherry-pick script to improve conflict summary generation
naspirato Nov 18, 2025
b19bb24
Refine conflict message extraction in cherry-pick script
naspirato Nov 19, 2025
28d2b67
Refine changelog category extraction in cherry-pick script
naspirato Nov 19, 2025
75976a0
Add missing conflict markers for special conflict types in cherry-pic…
naspirato Nov 19, 2025
1ca3115
Enhance logging in cherry-pick script for conflict handling
naspirato Nov 19, 2025
6785b48
Improve conflict handling in cherry-pick script
naspirato Nov 19, 2025
3e35848
Refactor conflict message extraction in cherry-pick script
naspirato Nov 19, 2025
aa1ee21
Refactor conflict message extraction in cherry-pick script
naspirato Nov 19, 2025
0bb88bb
Improve conflict handling and logging in cherry-pick script
naspirato Nov 20, 2025
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
60 changes: 60 additions & 0 deletions .github/actions/validate_pr_description/pr_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""
PR template and categories definitions for YDB project.
Used by both validate_pr_description.py and cherry_pick.py to ensure consistency.
"""

# Issue reference patterns for validation
ISSUE_PATTERNS = [
r"https://github.com/ydb-platform/[a-z\-]+/issues/\d+",
r"https://st.yandex-team.ru/[a-zA-Z]+-\d+",
r"#\d+",
r"[a-zA-Z]+-\d+"
]

# Full PR template
PULL_REQUEST_TEMPLATE = """### Changelog entry <!-- a user-readable short description of the changes that goes to CHANGELOG.md and Release Notes -->

...

### Changelog category <!-- remove all except one -->

* New feature
* Experimental feature
* Improvement
* Performance improvement
* User Interface
* Bugfix
* Backward incompatible change
* Documentation (changelog entry is not required)
* Not for changelog (changelog entry is not required)"""

# Categories that require changelog entry
FOR_CHANGELOG_CATEGORIES = [
"New feature",
"Experimental feature",
"User Interface",
"Improvement",
"Performance improvement",
"Bugfix",
"Backward incompatible change"
]

# Categories that don't require changelog entry
NOT_FOR_CHANGELOG_CATEGORIES = [
"Documentation (changelog entry is not required)",
"Not for changelog (changelog entry is not required)"
]

# All valid categories
ALL_CATEGORIES = FOR_CHANGELOG_CATEGORIES + NOT_FOR_CHANGELOG_CATEGORIES


def get_category_section_template() -> str:
"""Get the category section template as a string (for cherry_pick.py)"""
return "\n".join([f"* {cat}" for cat in ALL_CATEGORIES])


def get_category_section_for_selected(category: str) -> str:
"""Get category section with only selected category marked"""
return f"* {category}"

Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
import sys
import re
from typing import Tuple

issue_patterns = [
r"https://github.com/ydb-platform/[a-z\-]+/issues/\d+",
r"https://st.yandex-team.ru/[a-zA-Z]+-\d+",
r"#\d+",
r"[a-zA-Z]+-\d+"
]

pull_request_template = """
### Changelog entry <!-- a user-readable short description of the changes that goes to CHANGELOG.md and Release Notes -->

...

### Changelog category <!-- remove all except one -->

* New feature
* Experimental feature
* Improvement
* Performance improvement
* User Interface
* Bugfix
* Backward incompatible change
* Documentation (changelog entry is not required)
* Not for changelog (changelog entry is not required)
"""
from pr_template import (
ISSUE_PATTERNS,
PULL_REQUEST_TEMPLATE,
FOR_CHANGELOG_CATEGORIES,
NOT_FOR_CHANGELOG_CATEGORIES,
ALL_CATEGORIES
)

def validate_pr_description(description, is_not_for_cl_valid=True) -> bool:
try:
Expand All @@ -44,7 +26,7 @@ def check_pr_description(description, is_not_for_cl_valid=True) -> Tuple[bool, s
if "### Changelog category" not in description and "### Changelog entry" not in description:
return is_not_for_cl_valid, "Changelog category and entry sections are not found."

if pull_request_template.strip() in description.strip():
if PULL_REQUEST_TEMPLATE.strip() in description.strip():
return is_not_for_cl_valid, "Pull request template as is."

# Extract changelog category section
Expand All @@ -62,34 +44,18 @@ def check_pr_description(description, is_not_for_cl_valid=True) -> Tuple[bool, s
return False, txt

category = categories[0]
for_cl_categories = [
"New feature",
"Experimental feature",
"User Interface",
"Improvement",
"Performance improvement",
"Bugfix",
"Backward incompatible change"
]

not_for_cl_categories = [
"Documentation (changelog entry is not required)",
"Not for changelog (changelog entry is not required)"
]

valid_categories = for_cl_categories + not_for_cl_categories

if not any(cat.startswith(category) for cat in valid_categories):

if not any(cat.startswith(category) for cat in ALL_CATEGORIES):
txt = f"Invalid Changelog category: {category}"
print(f"::warning::{txt}")
return False, txt

if not is_not_for_cl_valid and any(cat.startswith(category) for cat in not_for_cl_categories):
if not is_not_for_cl_valid and any(cat.startswith(category) for cat in NOT_FOR_CHANGELOG_CATEGORIES):
txt = f"Category is not for changelog: {category}"
print(f"::notice::{txt}")
return False, txt

if not any(cat.startswith(category) for cat in not_for_cl_categories):
if not any(cat.startswith(category) for cat in NOT_FOR_CHANGELOG_CATEGORIES):
entry_section = re.search(r"### Changelog entry.*?\n(.*?)(\n###|$)", description, re.DOTALL)
if not entry_section or len(entry_section.group(1).strip()) < 20:
txt = "The changelog entry is less than 20 characters or missing."
Expand All @@ -100,7 +66,7 @@ def check_pr_description(description, is_not_for_cl_valid=True) -> Tuple[bool, s
def check_issue_pattern(issue_pattern):
return re.search(issue_pattern, description)

if not any(check_issue_pattern(issue_pattern) for issue_pattern in issue_patterns):
if not any(check_issue_pattern(issue_pattern) for issue_pattern in ISSUE_PATTERNS):
txt = "Bugfix requires a linked issue in the changelog entry"
print(f"::warning::{txt}")
return False, txt
Expand Down
Loading