attach_pr_to_tasks
Attach GitHub pull request to existing Asana tasks via the GitHub integration.
Type
boolean
Description
The attach_pr_to_tasks action links the current GitHub PR to existing Asana tasks through the Asana-GitHub integration. This creates a proper integration attachment with live PR status in Asana, rather than just a plain URL link.
Requirements
- Requires
has_asana_tasks: true(default) - Requires
integration_secretinput to be configured - Automatically deduplicates to avoid linking the same PR multiple times
Syntax
yaml
then:
attach_pr_to_tasks: trueSetup
Configure the integration_secret in your workflow:
yaml
- uses: planningcenter/asana-github-sync@main
with:
asana_token: ${{ secrets.ASANA_TOKEN }}
github_token: ${{ github.token }}
integration_secret: ${{ secrets.ASANA_INTEGRATION_SECRET }}
rules: |
# ...See Inputs documentation for details on obtaining your integration secret.
Examples
Attach When PR Opens
yaml
rules:
- when:
event: pull_request
action: opened
has_asana_tasks: true
then:
attach_pr_to_tasks: true
update_fields:
'1234567890': '0987654321' # Status → "In Review"Skip Draft PRs
yaml
rules:
- when:
event: pull_request
action: opened
has_asana_tasks: true
draft: false
then:
attach_pr_to_tasks: trueFull PR Lifecycle
yaml
rules:
# Attach when opened
- when:
event: pull_request
action: opened
has_asana_tasks: true
then:
attach_pr_to_tasks: true
update_fields:
'1234567890': '1111111111' # Status → "In Review"
# Update on changes (no re-attach needed)
- when:
event: pull_request
action: synchronize
then:
update_fields:
'1234567890': '2222222222' # Status → "Updated"
# Complete on merge
- when:
event: pull_request
action: closed
merged: true
then:
update_fields:
'1234567890': '3333333333' # Status → "Shipped"
mark_complete: trueBehavior
When attach_pr_to_tasks: true:
- Finds all Asana task URLs in PR description
- Checks if PR is already linked (deduplication)
- Attaches PR via Asana-GitHub integration if not already linked
- PR appears in Asana with live status
Combining Actions
| Action | Compatible? |
|---|---|
update_fields | ✅ Yes |
mark_complete | ✅ Yes |
post_pr_comment | ✅ Yes |
create_task | ❌ No (requires has_asana_tasks: false) |
Common Errors
Missing Integration Secret
yaml
# ❌ Wrong - will be skipped with warning
# (integration_secret not configured)
# ✅ Correct - include integration_secret in workflow inputs
- uses: planningcenter/asana-github-sync@main
with:
integration_secret: ${{ secrets.ASANA_INTEGRATION_SECRET }}Using with has_asana_tasks: false
yaml
# ❌ Wrong - can't attach to non-existent tasks
when:
has_asana_tasks: false
then:
attach_pr_to_tasks: true
# ✅ Correct
when:
has_asana_tasks: true # Or omit
then:
attach_pr_to_tasks: trueSee Also
- has_asana_tasks - Required condition
- update_fields - Update fields alongside attachment
- Inputs & Outputs - Setting up integration_secret