diff --git a/reusable_workflows/check_cla/check_cla_pr.py b/reusable_workflows/check_cla/check_cla_pr.py index 150b498..f474046 100644 --- a/reusable_workflows/check_cla/check_cla_pr.py +++ b/reusable_workflows/check_cla/check_cla_pr.py @@ -61,12 +61,12 @@ def get_cla_issue(self, user: str) -> Optional[GHIssue]: print(f"No CLA issue for {user}") return None # to make linter happy - def create_cla_issue(self, user: str) -> GHIssue: + def create_cla_issue(self, user: str, pr_url: str) -> GHIssue: user_agreement_message = messages.USER_AGREEMENT_MESSAGE.format(user) issue = self.cla_repo.create_issue( f"cla: @{user}", body=messages.CLA_AGREEMENT_MESSAGE.format( - user, self.cla_link, user_agreement_message + user, self.cla_link, user_agreement_message, pr_url ), ) issue.add_labels(PENDING_LABEL) @@ -106,7 +106,7 @@ def main() -> None: issue = cla.get_cla_issue(user) if not issue: - issue = cla.create_cla_issue(user) + issue = cla.create_cla_issue(user, pr.html_url) cla_signed = cla.check_if_cla_signed(issue, user) if cla_signed: diff --git a/reusable_workflows/shared/messages.py b/reusable_workflows/shared/messages.py index 1c8e028..247ce3f 100644 --- a/reusable_workflows/shared/messages.py +++ b/reusable_workflows/shared/messages.py @@ -16,7 +16,9 @@ If you decide to agree with it, please reply with the following message: > {} -— The DFINITY Foundation""" +— The DFINITY Foundation + +[PR link]({})""" AGREED_MESSAGE = """Dear @{}, diff --git a/reusable_workflows/tests/test_cla_pr.py b/reusable_workflows/tests/test_cla_pr.py index a6a0529..dcf02e6 100644 --- a/reusable_workflows/tests/test_cla_pr.py +++ b/reusable_workflows/tests/test_cla_pr.py @@ -132,10 +132,10 @@ def test_create_cla_issue(): cla.cla_link = "cla_repo_link" user_agreement_message = USER_AGREEMENT_MESSAGE.format("username") cla_agreement_message = CLA_AGREEMENT_MESSAGE.format( - "username", cla.cla_link, user_agreement_message + "username", cla.cla_link, user_agreement_message, "pr_url" ) - new_issue = cla.create_cla_issue("username") + new_issue = cla.create_cla_issue("username", "pr_url") assert new_issue == issue cla_repo.create_issue.assert_called_with(