Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions docs/first-merged-pr-comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 9 additions & 2 deletions tests/test_first_merged_pr_comment_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,15 @@ 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(
"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())
Expand Down
7 changes: 1 addition & 6 deletions workflow-templates/first-merged-pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 }}
Loading