Skip to content

Commit 505db2c

Browse files
denikclaude
andauthored
Fix update_github_links.py not to produce double parens (#4558)
This happened if you copy-paste title from github-generated commit into changelog. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 616a627 commit 505db2c

File tree

2 files changed

+75
-26
lines changed

2 files changed

+75
-26
lines changed

CHANGELOG.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
## Release v0.289.0 (2026-02-19)
1010

1111
### CLI
12-
* Make auth profiles respect DATABRICKS_CLI_PATH env var (([#4467](https://github.com/databricks/cli/pull/4467)))
13-
* Fix arrow key navigation in prompts on Windows (([#4501](https://github.com/databricks/cli/pull/4501)))
12+
* Make auth profiles respect DATABRICKS_CLI_PATH env var ([#4467](https://github.com/databricks/cli/pull/4467))
13+
* Fix arrow key navigation in prompts on Windows ([#4501](https://github.com/databricks/cli/pull/4501))
1414

1515
### Bundles
1616
* Log artifact build output in debug mode ([#4208](https://github.com/databricks/cli/pull/4208))
1717
* Fix bundle init not working in Azure Government ([#4286](https://github.com/databricks/cli/pull/4286))
18-
* Allow single and double quotes in environment dependencies (([#4511](https://github.com/databricks/cli/pull/4511)))
19-
* Use purge option when deleting alerts (([#4505](https://github.com/databricks/cli/pull/4505)))
18+
* Allow single and double quotes in environment dependencies ([#4511](https://github.com/databricks/cli/pull/4511))
19+
* Use purge option when deleting alerts ([#4505](https://github.com/databricks/cli/pull/4505))
2020
* engine/direct: Replace server_side_default with more precise backend_default rule in bundle plan ([#4490](https://github.com/databricks/cli/pull/4490))
21-
* engine/direct: Extend pipelines recreate_on_changes configuration (([#4499](https://github.com/databricks/cli/pull/4499)))
21+
* engine/direct: Extend pipelines recreate_on_changes configuration ([#4499](https://github.com/databricks/cli/pull/4499))
2222
* engine/direct: Added support for UC external locations (direct only) ([#4484](https://github.com/databricks/cli/pull/4484))
2323

2424
### Dependency updates
25-
* Upgrade Go SDK to v0.106.0 (([#4486](https://github.com/databricks/cli/pull/4486)))
26-
* Upgrade Terraform provider to v1.106.0 (([#4542](https://github.com/databricks/cli/pull/4542)))
27-
* Upgrade Go to 1.25.7 (([#4547](https://github.com/databricks/cli/pull/4547)))
25+
* Upgrade Go SDK to v0.106.0 ([#4486](https://github.com/databricks/cli/pull/4486))
26+
* Upgrade Terraform provider to v1.106.0 ([#4542](https://github.com/databricks/cli/pull/4542))
27+
* Upgrade Go to 1.25.7 ([#4547](https://github.com/databricks/cli/pull/4547))
2828

2929

3030
## Release v0.288.0 (2026-02-12)
@@ -49,7 +49,7 @@
4949
* Add support for Lakebase resources (postgres_projects, postgres_branches, postgres_endpoints) ([#4423](https://github.com/databricks/cli/pull/4423))
5050
* Add missing values to SchemaGrantPrivilege enum ([#4380](https://github.com/databricks/cli/pull/4380))
5151
* Added support for UC catalogs (only in direct mode) ([#4342](https://github.com/databricks/cli/pull/4342))
52-
* engine/direct: Fix updates to fields being ignored for database_catalogs, synced_database_tables (([#4388](https://github.com/databricks/cli/pull/4388)))
52+
* engine/direct: Fix updates to fields being ignored for database_catalogs, synced_database_tables ([#4388](https://github.com/databricks/cli/pull/4388))
5353
* engine/direct: Fix migration for database_instances, database_catalog, synced_database_tables ([#4424](https://github.com/databricks/cli/pull/4424))
5454
* Show warning message if valueFrom is used instead of value_from in app config section ([$4429](https://github.com/databricks/cli/pull/4429))
5555

@@ -77,9 +77,9 @@
7777
* Pass additional Azure DevOps `SYSTEM_*` environment variables to Terraform for OIDC authentication: `SYSTEM_COLLECTIONURI`, `SYSTEM_DEFINITIONID`, `SYSTEM_HOSTTYPE`, `SYSTEM_JOBID`, `SYSTEM_TEAMPROJECT` ([#4318](https://github.com/databricks/cli/pull/4318))
7878
* Add support for valueFrom property (similar to app.yaml) inside Apps config field in bundle configuration ([#4297](https://github.com/databricks/cli/pull/4297))
7979
* engine/direct: Support bind & unbind. ([#4279](https://github.com/databricks/cli/pull/4279))
80-
* engine/direct: Ignore changes between nulls and empty slices/maps (([#4313](https://github.com/databricks/cli/pull/4313)))
81-
* engine/direct: Ignore changes between nulls and empty structs (([#4338](https://github.com/databricks/cli/pull/4338)))
82-
* On terraform `bundle plan -o json` will no longer include plan_version key, it's intended for direct engine only (([#4314](https://github.com/databricks/cli/pull/4314)))
80+
* engine/direct: Ignore changes between nulls and empty slices/maps ([#4313](https://github.com/databricks/cli/pull/4313))
81+
* engine/direct: Ignore changes between nulls and empty structs ([#4338](https://github.com/databricks/cli/pull/4338))
82+
* On terraform `bundle plan -o json` will no longer include plan_version key, it's intended for direct engine only ([#4314](https://github.com/databricks/cli/pull/4314))
8383

8484

8585
## Release v0.283.0 (2026-01-14)
@@ -191,7 +191,7 @@ To disable this, set the environment variable DATABRICKS_CACHE_ENABLED to false.
191191
### Bundles
192192
* Add `default-minimal` template for users who want a clean slate without sample code ([#3885](https://github.com/databricks/cli/pull/3885))
193193
* Add validation that served_models and served_entities are not used at the same time. Add client side translation logic. ([#3880](https://github.com/databricks/cli/pull/3880))
194-
* Filter out provided permissions, to select a single permissions level per principal (([#3904](https://github.com/databricks/cli/pull/3904))).
194+
* Filter out provided permissions, to select a single permissions level per principal ([#3904](https://github.com/databricks/cli/pull/3904)).
195195

196196

197197
## Release v0.276.0 (2025-11-05)

tools/update_github_links.py

Lines changed: 62 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,38 @@
1717

1818
DEFAULT_FILES = ("NEXT_CHANGELOG.md", "CHANGELOG.md")
1919

20-
# Regex that matches an *already converted* link, e.g.:
21-
# ([#1234](https://github.com/databricks/cli/pull/1234))
22-
# The groups capture the PR number in the text and in the URL respectively so
23-
# they can be compared for consistency.
20+
# Canonical form: ([#1234](https://github.com/databricks/cli/pull/1234))
2421
CONVERTED_LINK_RE = re.compile(
2522
r"\(\[#(?P<num_text>\d+)\]\(" # ([#1234](
2623
r"https://github\.com/databricks/cli/pull/(?P<num_url>\d+)" # …/pull/1234
2724
r"\)\)" # ))
2825
)
2926

30-
# Regex that matches a *raw* reference, `#1234`, that is **not** already inside
31-
# a converted link. The negative look-behind ensures the # is not preceded by
32-
# a literal '[' which would indicate an already converted link.
33-
RAW_REF_RE = re.compile(r"(?<!\[)#(?P<num>\d+)\b")
27+
# Double-paren form produced by a previous incorrect run:
28+
# (([#1234](https://github.com/databricks/cli/pull/1234)))
29+
DOUBLE_PAREN_LINK_RE = re.compile(
30+
r"\(\(\[#(?P<num>\d+)\]\("
31+
r"https://github\.com/databricks/cli/pull/\d+"
32+
r"\)\)\)"
33+
)
34+
35+
# Raw reference already wrapped in parens: (#1234)
36+
PAREN_RAW_REF_RE = re.compile(r"\(#(?P<num>\d+)\)")
37+
38+
# Bare raw reference not already part of a converted link or paren-wrapped ref.
39+
# Negative look-behinds: '[' means it's inside a converted link; '(' means
40+
# it will be handled by PAREN_RAW_REF_RE above.
41+
RAW_REF_RE = re.compile(r"(?<!\[)(?<!\()#(?P<num>\d+)\b")
3442

3543

3644
def find_mismatched_links(text):
37-
"""Return texts of mismatching converted links."""
45+
"""Return texts of mismatching converted links.
46+
47+
>>> find_mismatched_links("([#1234](https://github.com/databricks/cli/pull/1234))")
48+
[]
49+
>>> find_mismatched_links("([#1234](https://github.com/databricks/cli/pull/9999))")
50+
['Converted link numbers differ: text #1234 vs URL #9999 — …([#1234](https://github.com/databricks/cli/pull/9999))…']
51+
"""
3852
mismatches = []
3953
for m in CONVERTED_LINK_RE.finditer(text):
4054
num_text, num_url = m.group("num_text"), m.group("num_url")
@@ -45,13 +59,48 @@ def find_mismatched_links(text):
4559

4660

4761
def convert_raw_references(text):
48-
"""Convert raw `#1234` references to markdown links."""
62+
"""Convert raw `#1234` references to markdown links.
63+
64+
Already-converted single-paren links are left unchanged:
65+
66+
>>> convert_raw_references("([#1234](https://github.com/databricks/cli/pull/1234))")
67+
'([#1234](https://github.com/databricks/cli/pull/1234))'
68+
69+
Double-paren links from a previous incorrect run are collapsed to single-paren:
70+
71+
>>> convert_raw_references("(([#1234](https://github.com/databricks/cli/pull/1234)))")
72+
'([#1234](https://github.com/databricks/cli/pull/1234))'
73+
74+
A raw reference with surrounding parens becomes a single-paren link (not double):
4975
50-
def _repl(match):
51-
num = match.group("num")
76+
>>> convert_raw_references("(#3456)")
77+
'([#3456](https://github.com/databricks/cli/pull/3456))'
78+
79+
A bare raw reference gets wrapped in a single-paren link:
80+
81+
>>> convert_raw_references("#3456")
82+
'([#3456](https://github.com/databricks/cli/pull/3456))'
83+
84+
Idempotent: running twice produces the same result:
85+
86+
>>> t = "(#3456) and #7890"
87+
>>> convert_raw_references(convert_raw_references(t)) == convert_raw_references(t)
88+
True
89+
"""
90+
91+
def _make_link(num):
5292
return f"([#{num}](https://github.com/databricks/cli/pull/{num}))"
5393

54-
return RAW_REF_RE.sub(_repl, text)
94+
# Fix existing double-paren links produced by a previous incorrect run.
95+
text = DOUBLE_PAREN_LINK_RE.sub(lambda m: _make_link(m.group("num")), text)
96+
97+
# Convert (#1234) — parens already present, replace the whole token.
98+
text = PAREN_RAW_REF_RE.sub(lambda m: _make_link(m.group("num")), text)
99+
100+
# Convert bare #1234 — not preceded by [ (converted) or ( (paren-wrapped).
101+
text = RAW_REF_RE.sub(lambda m: _make_link(m.group("num")), text)
102+
103+
return text
55104

56105

57106
def process_file(path):

0 commit comments

Comments
 (0)