From 375d6194b4cb6ab111f35e77899ea5afa1c034bf Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 23 Sep 2026 17:11:55 -0300 Subject: [PATCH 1/4] fix: require repository message variable Signed-off-by: Vitor Mattos --- workflow-templates/first-merged-pr-comment.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/workflow-templates/first-merged-pr-comment.yml b/workflow-templates/first-merged-pr-comment.yml index c320040..1f96633 100644 --- a/workflow-templates/first-merged-pr-comment.yml +++ b/workflow-templates/first-merged-pr-comment.yml @@ -38,11 +38,6 @@ jobs: permissions: pull-requests: write - env: - FIRST_MERGED_PR_MESSAGE: >- - ${{ vars.FIRST_MERGED_PR_MESSAGE || - 'Thanks {contributor_mention}! Your first pull request to {repository_name} has been merged.' }} - steps: # pull_request_target is intentionally used without checkout. Nothing # from the pull request head is downloaded or executed. @@ -52,4 +47,4 @@ jobs: github-token: ${{ github.token }} pull-request-number: >- ${{ github.event.pull_request.number || inputs.pull_request_number }} - message-template: ${{ env.FIRST_MERGED_PR_MESSAGE }} + message-template: ${{ vars.FIRST_MERGED_PR_MESSAGE }} From de719910b70f9ed8e310718c10b9b6b459bde2cc Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 23 Sep 2026 17:11:59 -0300 Subject: [PATCH 2/4] test: require repository message variable Signed-off-by: Vitor Mattos --- tests/test_first_merged_pr_comment_action.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_first_merged_pr_comment_action.py b/tests/test_first_merged_pr_comment_action.py index afa40a1..94a4650 100644 --- a/tests/test_first_merged_pr_comment_action.py +++ b/tests/test_first_merged_pr_comment_action.py @@ -230,8 +230,12 @@ def test_workflow_template_only_exposes_message_configuration(self) -> None: workflow = ( ROOT / "workflow-templates" / "first-merged-pr-comment.yml" ).read_text(encoding="utf-8") - self.assertIn("vars.FIRST_MERGED_PR_MESSAGE", workflow) - self.assertIn("message-template:", workflow) + self.assertIn( + "message-template: ${{ vars.FIRST_MERGED_PR_MESSAGE }}", + workflow, + ) + self.assertNotIn("env:\n FIRST_MERGED_PR_MESSAGE", workflow) + self.assertNotIn("||", workflow) self.assertNotIn("survey", workflow.lower()) self.assertNotIn("community", workflow.lower()) self.assertNotIn("good first issue", workflow.lower()) From 74a9839ca8e9cb8d86a932b51bc27f22afad7ff3 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 23 Sep 2026 17:12:03 -0300 Subject: [PATCH 3/4] docs: require first merged PR message variable Signed-off-by: Vitor Mattos --- docs/first-merged-pr-comment.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/first-merged-pr-comment.md b/docs/first-merged-pr-comment.md index 706882f..f3a2ce0 100644 --- a/docs/first-merged-pr-comment.md +++ b/docs/first-merged-pr-comment.md @@ -63,12 +63,14 @@ publishing a partially rendered message. ## Repository configuration -The organization workflow template reads the optional repository variable -`FIRST_MERGED_PR_MESSAGE`. If it is absent, the installed workflow uses a -minimal generic message. - -A consumer can put its entire Markdown message in that single variable. For -example: +The organization workflow template requires the repository Actions variable +`FIRST_MERGED_PR_MESSAGE`. The workflow passes that variable directly to the +action. If it is absent or empty, the action fails instead of publishing a +fallback message. + +Configure the variable under **Settings → Secrets and variables → Actions → +Variables**. A consumer can put its entire Markdown message in that single +variable. For example: ```text Thanks {contributor_mention}! Your first pull request to {repository_name} has been merged. From 6ed01661107bcc5179d639d51f0ad8aa8d319d4b Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 23 Sep 2026 17:13:11 -0300 Subject: [PATCH 4/4] test: target first merged PR fallback assertion Signed-off-by: Vitor Mattos --- tests/test_first_merged_pr_comment_action.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_first_merged_pr_comment_action.py b/tests/test_first_merged_pr_comment_action.py index 94a4650..f1b71cf 100644 --- a/tests/test_first_merged_pr_comment_action.py +++ b/tests/test_first_merged_pr_comment_action.py @@ -235,7 +235,10 @@ def test_workflow_template_only_exposes_message_configuration(self) -> None: workflow, ) self.assertNotIn("env:\n FIRST_MERGED_PR_MESSAGE", workflow) - self.assertNotIn("||", workflow) + self.assertNotIn( + "Thanks {contributor_mention}! Your first pull request", + workflow, + ) self.assertNotIn("survey", workflow.lower()) self.assertNotIn("community", workflow.lower()) self.assertNotIn("good first issue", workflow.lower())