mark_complete
Mark existing Asana tasks as complete.
Type
boolean
Description
The mark_complete action marks all tasks linked in the PR description as complete. This is only allowed when has_asana_tasks: true (default) or when the PR has Asana task URLs.
Use this to automatically complete tasks when PRs are merged or when work is done.
Critical Requirement
mark_complete requires has_asana_tasks: true (default). You cannot mark non-existent tasks as complete.
Syntax
then:
mark_complete: trueExamples
Mark Complete on Merge
Most common pattern - complete tasks when PR ships:
rules:
- when:
event: pull_request
action: closed
merged: true
then:
mark_complete: trueWith Field Update
Update status and mark complete:
rules:
- when:
event: pull_request
action: closed
merged: true
then:
update_fields:
'1234567890': '0987654321' # Status → "Shipped"
mark_complete: trueWith PR Comment
Notify and complete:
rules:
- when:
event: pull_request
action: closed
merged: true
then:
update_fields:
'1234567890': '0987654321' # Status → "Shipped"
mark_complete: true
post_pr_comment: |
✅ PR merged! Asana task marked complete.Conditional Completion
Only mark complete for certain PRs:
rules:
# Regular PRs - just mark complete
- when:
event: pull_request
action: closed
merged: true
draft: false
then:
mark_complete: true
# Don't mark complete for draft PRs that get merged
# (no rule = no action)Label-Based Completion
Complete when specific label added:
rules:
- when:
event: pull_request
action: labeled
label: 'deployed-to-production'
then:
update_fields:
'1234567890': '0987654321' # Status → "Deployed"
mark_complete: trueCombining Actions
mark_complete can be combined with other actions:
| Action | Compatible? | Example |
|---|---|---|
update_fields | ✅ Yes | Update status then mark complete |
post_pr_comment | ✅ Yes | Post comment and mark complete |
create_task | ❌ No | Different conditions required |
Update Then Complete
then:
update_fields:
'1234567890': '0987654321' # Status → "Shipped"
mark_complete: trueComplete with Notification
then:
mark_complete: true
post_pr_comment: |
✅ Work completed! Task marked done in Asana.Behavior
When mark_complete: true:
- Action finds all Asana task URLs in PR description
- Each task is marked complete in Asana
- Completion timestamp is recorded
- Task moves to completed section in Asana
TIP
If a task is already complete, marking it complete again is safe (no error).
Common Patterns
Standard Merge Workflow
The most common pattern:
rules:
# When PR opens
- when:
event: pull_request
action: opened
then:
update_fields:
'1234567890': '1111111111' # Status → "In Review"
# When PR merges
- when:
event: pull_request
action: closed
merged: true
then:
update_fields:
'1234567890': '2222222222' # Status → "Shipped"
mark_complete: trueSkip Draft PRs
Don't complete draft PR tasks:
rules:
- when:
event: pull_request
action: closed
merged: true
draft: false # Only non-draft PRs
then:
mark_complete: trueComplete on Deployment
Wait for deployment label:
rules:
# PR merged → update status
- when:
event: pull_request
action: closed
merged: true
then:
update_fields:
'1234567890': '1111111111' # Status → "Merged"
# Deployment label → mark complete
- when:
event: pull_request
action: labeled
label: 'deployed'
then:
update_fields:
'1234567890': '2222222222' # Status → "Deployed"
mark_complete: trueAuthor-Specific Completion
Different completion logic per author:
rules:
# Bot PRs - auto complete on merge
- when:
event: pull_request
action: closed
merged: true
author: ['dependabot[bot]', 'renovate[bot]']
then:
mark_complete: true
# Human PRs - just update status
- when:
event: pull_request
action: closed
merged: true
then:
update_fields:
'1234567890': '0987654321' # Status → "Shipped"
# Don't auto-complete - let humans decideValidation Rules
- Requires:
has_asana_tasks: true(default) - Type: Must be boolean (
trueorfalse) - Typical value:
true(marking incomplete rarely used)
Common Errors
Using with has_asana_tasks: false
# ❌ Wrong - can't complete non-existent tasks
when:
event: pull_request
has_asana_tasks: false
then:
mark_complete: true
# Error: has_asana_tasks: false cannot have mark_complete
# ✅ Correct - use with existing tasks
when:
event: pull_request
has_asana_tasks: true # Or omit
then:
mark_complete: trueWrong type
# ❌ Wrong - must be boolean
then:
mark_complete: "true"
# ✅ Correct - use boolean
then:
mark_complete: trueUsing with create_task
# ❌ Wrong - incompatible conditions
when:
event: pull_request
has_asana_tasks: false
then:
create_task:
# ...
mark_complete: true # Error!
# ✅ Correct - separate rules
rules:
# Create task
- when:
event: pull_request
action: opened
has_asana_tasks: false
then:
create_task:
# ...
# Mark complete (different rule, different PR)
- when:
event: pull_request
action: closed
merged: true
has_asana_tasks: true
then:
mark_complete: trueWhen to Mark Complete
✅ Good Use Cases
- PR merged to main/production branch
- Deployment label added
- QA approval received
- All checks passing and approved
⚠️ Consider Carefully
- Closing PR without merge (might be abandoned)
- Draft PRs (might not be real work)
- Bot PRs (depends on your workflow)
❌ Avoid
- PR opened (work just started!)
- Changes pushed (work in progress)
- PR converted to draft (not ready)
See Also
- merged - Filter by merge status
- update_fields - Update fields before completing
- post_pr_comment - Notify about completion
- has_asana_tasks - Required condition