This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new c05b6c2  Add a RELEASE_CHECKLIST variable for use in emails to start a 
vote
c05b6c2 is described below

commit c05b6c27773c8b288518e8d23e462797ed78b1c7
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri May 2 11:44:34 2025 +0100

    Add a RELEASE_CHECKLIST variable for use in emails to start a vote
---
 atr/construct.py   | 15 ++++++++++-----
 atr/db/__init__.py |  8 ++++++++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/atr/construct.py b/atr/construct.py
index 3dcec12..be9f872 100644
--- a/atr/construct.py
+++ b/atr/construct.py
@@ -123,7 +123,13 @@ async def start_vote_body(body: str, options: 
StartVoteOptions) -> str:
 
     review_url = 
f"https://{host}/vote/{options.project_name}/{options.version_name}";
     committee_name = release.committee.display_name if release.committee else 
release.project.display_name
-    project_short_display_name = release.project.short_display_name
+    project_short_display_name = release.project.short_display_name if 
release.project else options.project_name
+
+    checklist_content = ""
+    async with db.session() as data:
+        vote_policy = await db.get_project_vote_policy(data, 
options.project_name)
+        if vote_policy:
+            checklist_content = vote_policy.release_checklist or ""
 
     # Perform substitutions in the body
     # TODO: Handle the DURATION == 0 case
@@ -131,6 +137,7 @@ async def start_vote_body(body: str, options: 
StartVoteOptions) -> str:
     body = body.replace("[DURATION]", str(options.vote_duration))
     body = body.replace("[KEY_FINGERPRINT]", user_key_fingerprint or "(No key 
found)")
     body = body.replace("[PROJECT]", project_short_display_name)
+    body = body.replace("[RELEASE_CHECKLIST]", checklist_content)
     body = body.replace("[REVIEW_URL]", review_url)
     body = body.replace("[VERSION]", options.version_name)
     body = body.replace("[YOUR_ASF_ID]", options.asfuid)
@@ -140,10 +147,8 @@ async def start_vote_body(body: str, options: 
StartVoteOptions) -> str:
 
 async def start_vote_default(project_name: str) -> str:
     async with db.session() as data:
-        project = await data.project(name=project_name, 
_vote_policy=True).demand(
-            RuntimeError(f"Project {project_name} not found")
-        )
-        vote_policy = project.vote_policy
+        vote_policy = await db.get_project_vote_policy(data, project_name)
+
     if vote_policy is not None:
         # NOTE: Do not use "if vote_policy.announce_release_template is None"
         # We want to check for the empty string too
diff --git a/atr/db/__init__.py b/atr/db/__init__.py
index 9924367..4b1b0aa 100644
--- a/atr/db/__init__.py
+++ b/atr/db/__init__.py
@@ -488,6 +488,14 @@ async def create_async_engine(app_config: 
type[config.AppConfig]) -> sqlalchemy.
     return engine
 
 
+async def get_project_vote_policy(data: Session, project_name: str) -> 
models.VotePolicy | None:
+    """Fetch the VotePolicy for a project."""
+    project = await data.project(name=project_name, _vote_policy=True).demand(
+        RuntimeError(f"Project {project_name} not found")
+    )
+    return project.vote_policy
+
+
 def init_database(app: base.QuartApp) -> None:
     """
     Creates and initializes the database for a QuartApp.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to