Skip to content
Closed
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
6b621df
Enhance cherry-pick script with support for unmerged PRs and improved…
naspirato Nov 18, 2025
8552c22
Enhance cherry-pick script with changelog extraction and improved PR …
naspirato Nov 18, 2025
102ac95
Enhance cherry-pick script to avoid branch name conflicts and improve…
naspirato Nov 18, 2025
f064c5d
Enhance cherry-pick script to include detailed conflict resolution in…
naspirato Nov 18, 2025
391896e
Add PR template and category definitions for validation
naspirato Nov 18, 2025
a22daf4
Enhance cherry-pick script with improved error handling and conflict …
naspirato Nov 18, 2025
ed3267e
Enhance cherry-pick script with improved conflict handling and logging
naspirato Nov 18, 2025
fccbda3
Refactor changelog extraction in cherry-pick script
naspirato Nov 18, 2025
88c83ad
Enhance cherry-pick script with improved diff link generation
naspirato Nov 18, 2025
1ea50f0
Enhance cherry-pick script with improved backport comment management
naspirato Nov 18, 2025
1cf3ccb
Refactor cherry-pick script for improved PR validation and changelog …
naspirato Nov 18, 2025
6b14cb9
Update cherry-pick script to change cherry-pick command options
naspirato Nov 18, 2025
8805c9a
Refactor cherry-pick command in script to simplify handling of empty …
naspirato Nov 18, 2025
12a4d4d
Refactor cherry-pick script to streamline commit existence checks and…
naspirato Nov 18, 2025
f2fb02b
Enhance cherry-pick script to improve conflict message handling and l…
naspirato Nov 18, 2025
041d2f5
Enhance cherry-pick script to improve conflict summary generation
naspirato Nov 18, 2025
0b24c4e
Refine conflict message extraction in cherry-pick script
naspirato Nov 19, 2025
870456f
Refine changelog category extraction in cherry-pick script
naspirato Nov 19, 2025
deede0b
Add missing conflict markers for special conflict types in cherry-pic…
naspirato Nov 19, 2025
3363bbf
Enhance logging in cherry-pick script for conflict handling
naspirato Nov 19, 2025
6738c61
Improve conflict handling in cherry-pick script
naspirato Nov 19, 2025
55f9dc4
Refactor conflict message extraction in cherry-pick script
naspirato Nov 19, 2025
7cfd561
Refactor conflict message extraction in cherry-pick script
naspirato Nov 19, 2025
03bbbf3
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}"

60 changes: 13 additions & 47 deletions .github/actions/validate_pr_description/validate_pr_description.py
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
Loading