The post_pr_comment action posts a comment on the GitHub PR. The comment supports Handlebars templating, allowing you to include dynamic content from the PR context.
This action works with both has_asana_tasks: true and has_asana_tasks: false, making it the most flexible action.
rules: - when: event: pull_request action: opened has_asana_tasks: false then: post_pr_comment: | ⚠️ No Asana task found in PR description. Please add the Asana task URL to track this work: ``` https://app.asana.com/0/PROJECT/TASK ```
Comments are considered duplicates if the entire body text matches exactly:
yaml
# These are DIFFERENT (both will be posted):"✅ Task updated""✅ Task Updated" # Different capitalization# These are DIFFERENT:"✅ Task updated""✅ Task updated " # Extra space at end# These are THE SAME (only posted once):"✅ Task updated""✅ Task updated" # Exact match
Exact Match Only
Even minor differences (whitespace, capitalization, punctuation) will result in a new comment being posted.
# ✅ Good - posts once per PRpost_pr_comment: | ✅ Asana task updated to "In Review"
Or make dynamic content consistent:
yaml
# ✅ Good - predictable deduplicationpost_pr_comment: | PR #{{pr.number}} is ready for review
Avoid variable timestamps or changing data:
yaml
# ❌ Problematic - always posts (timestamp changes)post_pr_comment: | Updated at {{current_time}}# ❌ Problematic - new comment every time status changespost_pr_comment: | Current status: {{task.status}}
post_pr_comment
Post a comment on the GitHub PR.
Type
string(Handlebars template)Description
The
post_pr_commentaction posts a comment on the GitHub PR. The comment supports Handlebars templating, allowing you to include dynamic content from the PR context.This action works with both
has_asana_tasks: trueandhas_asana_tasks: false, making it the most flexible action.Syntax
Examples
Simple Notification
Post a basic comment:
Dynamic Content
Include PR details:
Conditional Messages
Use helpers for logic:
Missing Task Warning
Prompt for Asana URL:
Task Creation Confirmation
Notify about auto-created tasks:
Build Status Updates
Post build information:
QA Instructions
Provide context for reviewers:
Multi-line with Formatting
Use markdown in comments:
Template Variables
All context variables are available:
pr.number42pr.title"Add feature"pr.bodypr.author"octocat"pr.assignee"reviewer"pr.urlhttps://github.com/...pr.mergedtrue/falsepr.drafttrue/falsepr.base_ref"main"pr.head_ref"feature"event.name"pull_request"event.action"opened"label.name"ready-for-qa"Template Helpers
All helpers work in comments:
extract_from_body\{\{extract_from_body "Version: ([\\d.]+)"\}\}extract_from_title\{\{extract_from_title "\\[(\\w+)\\]"\}\}extract_from_comments\{\{extract_from_comments "Build #(\\d+)"\}\}clean_title\{\{clean_title pr.title\}\}sanitize_markdown\{\{sanitize_markdown pr.body\}\}map_github_to_asana\{\{map_github_to_asana pr.author\}\}or\{\{or pr.assignee "Unassigned"\}\}Comment Deduplication
Automatic Deduplication
The action automatically prevents duplicate comments when workflows re-run. Comments are deduplicated by exact body match.
How It Works
Before posting a comment:
Matching Rules
Comments are considered duplicates if the entire body text matches exactly:
Exact Match Only
Even minor differences (whitespace, capitalization, punctuation) will result in a new comment being posted.
Dynamic Content and Deduplication
If your comment includes dynamic values, each unique value combination creates a new comment:
This will post:
Best Practices
Use static messages for notifications:
Or make dynamic content consistent:
Avoid variable timestamps or changing data:
Common Patterns
Status Update Notification
Let team know task was updated:
Missing Task Prompt
Remind users to add Asana link:
Completion Confirmation
Confirm work is done:
Build Notifications
Share build information:
Summary with Details
Provide comprehensive update:
Comment Formatting
Markdown Support
GitHub comments support markdown:
Links
@mentions
Mention GitHub users:
Validation Rules
Common Errors
Empty comment
Wrong type
Template errors
When to Use Comments
✅ Good Use Cases
⚠️ Use Sparingly
❌ Avoid
See Also