|
32 | 32 | OWNER = "confident-ai" |
33 | 33 | REPO = "deepeval" |
34 | 34 |
|
35 | | -START_MARKER = "<!-- DeepEval release notes start -->" |
| 35 | +START_MARKER = "{/* DeepEval release notes start */}" |
| 36 | +LEGACY_START_MARKER = "<!-- DeepEval release notes start -->" |
36 | 37 |
|
37 | 38 | CATEGORY_ORDER = [ |
38 | 39 | "Backward Incompatible Change", |
@@ -148,21 +149,25 @@ class AiMonthSummary(BaseModel): |
148 | 149 | # - Prefer the stable marker (lets humans edit the visible link/text) |
149 | 150 | # - Fall back to parsing the link if the marker is missing |
150 | 151 | BULLET_PR_RE = re.compile(r"\[#(\d+)\]\(") |
151 | | -BULLET_PR_MARKER_RE = re.compile(r"<!--\s*pr:(\d+)\s*-->") |
| 152 | +BULLET_PR_MARKER_RE = re.compile( |
| 153 | + r"(?:<!--\s*pr:(\d+)\s*-->|\{/\*\s*pr:(\d+)\s*\*/\})" |
| 154 | +) |
152 | 155 | BULLET_TAIL_RE = re.compile( |
153 | | - r"\s*\(\[#\d+\]\([^)]+\)\)\s*<!--\s*pr:\d+\s*-->.*$" |
| 156 | + r"\s*\(\[#\d+\]\([^)]+\)\)\s*(?:<!--\s*pr:\d+\s*-->|\{/\*\s*pr:\d+\s*\*/\}).*$" |
154 | 157 | ) |
155 | 158 |
|
156 | 159 | # Optional ignore list to be placed right after START_MARKER to avoid confusing the parser: |
157 | 160 | # add a list of PR numbers you would like to be excluded from the generated changelog. |
158 | | -# <!-- changelog-ignore: |
| 161 | +# {/* changelog-ignore: |
159 | 162 | # - 1234 |
160 | 163 | # - 5678 |
161 | | -# --> |
| 164 | +# */} |
162 | 165 | IGNORE_BLOCK_TOP_RE = re.compile( |
163 | | - r"(?is)^\s*<!--\s*changelog-ignore:.*?-->\s*\n*" |
| 166 | + r"(?is)^\s*(?:<!--\s*changelog-ignore:.*?-->|\{/\*\s*changelog-ignore:.*?\*/\})\s*\n*" |
| 167 | +) |
| 168 | +IGNORE_BLOCK_ANY_RE = re.compile( |
| 169 | + r"(?is)(?:<!--\s*changelog-ignore:(.*?)-->|\{/\*\s*changelog-ignore:(.*?)\*/\})" |
164 | 170 | ) |
165 | | -IGNORE_BLOCK_ANY_RE = re.compile(r"(?is)<!--\s*changelog-ignore:(.*?)-->") |
166 | 171 |
|
167 | 172 | ############### |
168 | 173 | # Git helpers # |
@@ -761,8 +766,16 @@ def _pull_top_ignore_block(s: str) -> Tuple[str, str]: |
761 | 766 | rest = s2[matched.end() :] |
762 | 767 | return ignore_block.rstrip("\n") + "\n", rest |
763 | 768 |
|
764 | | - if START_MARKER in text: |
765 | | - before, _, after = text.partition(START_MARKER) |
| 769 | + marker_in_text = next( |
| 770 | + ( |
| 771 | + marker |
| 772 | + for marker in (START_MARKER, LEGACY_START_MARKER) |
| 773 | + if marker in text |
| 774 | + ), |
| 775 | + None, |
| 776 | + ) |
| 777 | + if marker_in_text: |
| 778 | + before, _, after = text.partition(marker_in_text) |
766 | 779 | ignore_block, rest = _pull_top_ignore_block(after) |
767 | 780 | prefix = before.rstrip() + "\n\n" + START_MARKER + "\n" |
768 | 781 | if ignore_block: |
@@ -792,21 +805,21 @@ def _pull_top_ignore_block(s: str) -> Tuple[str, str]: |
792 | 805 |
|
793 | 806 | def parse_ignore_prs(text: str) -> set[int]: |
794 | 807 | """ |
795 | | - Parse PR numbers from one or more `<!-- changelog-ignore: ... -->` HTML comment blocks. |
| 808 | + Parse PR numbers from one or more changelog-ignore comment blocks. |
796 | 809 |
|
797 | 810 | Should be placed immediately after the `START_MARKER`, for example: |
798 | 811 |
|
799 | | - <!-- changelog-ignore: |
| 812 | + {/* changelog-ignore: |
800 | 813 | - 1234 |
801 | 814 | - 5678 |
802 | | - --> |
| 815 | + */} |
803 | 816 |
|
804 | 817 | Lines may contain comments which can be used to document why a PR is being ignored |
805 | 818 | Any integers found in the block are treated as PR numbers. |
806 | 819 | """ |
807 | 820 | ignored: set[int] = set() |
808 | 821 | for matched in IGNORE_BLOCK_ANY_RE.finditer(text): |
809 | | - block = matched.group(1) |
| 822 | + block = next(group for group in matched.groups() if group is not None) |
810 | 823 | for line in block.splitlines(): |
811 | 824 | line = line.strip() |
812 | 825 | if not line or line.startswith("#"): |
@@ -875,7 +888,7 @@ def parse_body(body: str) -> ChangelogIndex: |
875 | 888 | ) |
876 | 889 | if not matched: |
877 | 890 | continue |
878 | | - pr = int(matched.group(1)) |
| 891 | + pr = int(next(group for group in matched.groups() if group)) |
879 | 892 | idx[month][category][version][pr] = line.rstrip() |
880 | 893 |
|
881 | 894 | return idx |
@@ -1143,7 +1156,7 @@ def _tick() -> None: |
1143 | 1156 | author = f" ({user_display})" |
1144 | 1157 | line = ( |
1145 | 1158 | f"- {title_out} ([#{pr_num}](https://github.com/{OWNER}/{REPO}/pull/{pr_num})) " |
1146 | | - f"<!-- pr:{pr_num} -->{author}" |
| 1159 | + f"{{/* pr:{pr_num} */}}{author}" |
1147 | 1160 | ) |
1148 | 1161 | idx[month][category][tag][pr_num] = line |
1149 | 1162 | _status(f"[{tag}] PR #{pr_num}: done") |
|
0 commit comments