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-releases.git


The following commit(s) were added to refs/heads/main by this push:
     new 8229b79  Add an API endpoint to get the release policy of a project
8229b79 is described below

commit 8229b793c4b4959b9699650ffe0ebf3853cd9bba
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Jan 8 17:17:25 2026 +0000

    Add an API endpoint to get the release policy of a project
---
 atr/api/__init__.py | 37 +++++++++++++++++++++++++++++++++++++
 atr/models/api.py   | 24 ++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/atr/api/__init__.py b/atr/api/__init__.py
index 93348be..06c932e 100644
--- a/atr/api/__init__.py
+++ b/atr/api/__init__.py
@@ -552,6 +552,43 @@ async def project_get(name: str) -> DictResponse:
     ).model_dump(), 200
 
 
[email protected]("/project/policy/<name>")
+@quart_schema.validate_response(models.api.ProjectPolicyResults, 200)
+async def project_policy(name: str) -> DictResponse:
+    """
+    Get project policy by name.
+
+    Returns the release policy settings for a project.
+    If no policy has been configured, defaults are returned.
+    """
+    _simple_check(name)
+    async with db.session() as data:
+        project = await data.project(name=name, _release_policy=True, 
_committee=True).demand(exceptions.NotFound())
+    return models.api.ProjectPolicyResults(
+        endpoint="/project/policy",
+        project_name=project.name,
+        
policy_announce_release_subject=project.policy_announce_release_subject,
+        
policy_announce_release_template=project.policy_announce_release_template,
+        policy_binary_artifact_paths=project.policy_binary_artifact_paths,
+        
policy_github_compose_workflow_path=project.policy_github_compose_workflow_path,
+        
policy_github_finish_workflow_path=project.policy_github_finish_workflow_path,
+        policy_github_repository_name=project.policy_github_repository_name,
+        
policy_github_vote_workflow_path=project.policy_github_vote_workflow_path,
+        policy_license_check_mode=project.policy_license_check_mode,
+        policy_mailto_addresses=project.policy_mailto_addresses,
+        policy_manual_vote=project.policy_manual_vote,
+        policy_min_hours=project.policy_min_hours,
+        policy_pause_for_rm=project.policy_pause_for_rm,
+        policy_preserve_download_files=project.policy_preserve_download_files,
+        policy_release_checklist=project.policy_release_checklist,
+        policy_source_artifact_paths=project.policy_source_artifact_paths,
+        policy_start_vote_subject=project.policy_start_vote_subject,
+        policy_start_vote_template=project.policy_start_vote_template,
+        policy_strict_checking=project.policy_strict_checking,
+        policy_vote_comment_template=project.policy_vote_comment_template,
+    ).model_dump(), 200
+
+
 @api.route("/project/releases/<name>")
 @quart_schema.validate_response(models.api.ProjectReleasesResults, 200)
 async def project_releases(name: str) -> DictResponse:
diff --git a/atr/models/api.py b/atr/models/api.py
index 716fbce..d06c5d3 100644
--- a/atr/models/api.py
+++ b/atr/models/api.py
@@ -207,6 +207,30 @@ class ProjectGetResults(schema.Strict):
     project: sql.Project
 
 
+class ProjectPolicyResults(schema.Strict):
+    endpoint: Literal["/project/policy"] = schema.alias("endpoint")
+    project_name: str
+    policy_announce_release_subject: str
+    policy_announce_release_template: str
+    policy_binary_artifact_paths: list[str]
+    policy_github_compose_workflow_path: list[str]
+    policy_github_finish_workflow_path: list[str]
+    policy_github_repository_name: str
+    policy_github_vote_workflow_path: list[str]
+    policy_license_check_mode: sql.LicenseCheckMode
+    policy_mailto_addresses: list[str]
+    policy_manual_vote: bool
+    policy_min_hours: int
+    policy_pause_for_rm: bool
+    policy_preserve_download_files: bool
+    policy_release_checklist: str
+    policy_source_artifact_paths: list[str]
+    policy_start_vote_subject: str
+    policy_start_vote_template: str
+    policy_strict_checking: bool
+    policy_vote_comment_template: str
+
+
 class ProjectReleasesResults(schema.Strict):
     endpoint: Literal["/project/releases"] = schema.alias("endpoint")
     releases: Sequence[sql.Release]


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

Reply via email to