From 0e918da4845dafda844168b28c20d9112141ec8d Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Tue, 20 Aug 2024 15:32:00 +0200 Subject: [PATCH] legal-auto: Link to legal review via comment It's rather hard for packagers to find the matching legal review for their OBS/IBS request. A comment with link should help make legal information more widely accessible. --- legal-auto.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/legal-auto.py b/legal-auto.py index eba57d394..319a8a525 100755 --- a/legal-auto.py +++ b/legal-auto.py @@ -20,6 +20,7 @@ import osc.conf import osc.core from osclib.cache_manager import CacheManager +from osclib.comments import CommentAPI import ReviewBot http_GET = osc.core.http_GET @@ -79,6 +80,12 @@ def create_db_entry(self, src_project, src_package, src_rev): url = osc.core.makeurl(self.legaldb, ['requests'], {'external_link': self.request_nick(), 'package': package['id']}) REQ.post(url, headers=self.legaldb_headers) + + comment_api = CommentAPI(self.apiurl) + review_url = osc.core.makeurl(self.legaldb, ['reviews', 'details', str(package['id'])]) + review_comment = f"Legal review details available at {review_url} (access may be restricted)" + comment_api.add_comment(request_id=self.request.reqid, comment=review_comment) + return [package['id']] def valid_for_opensuse(self, target_project, report):