event
The GitHub event name that triggers the workflow. This is the only required condition.
Type
string
Description
The event condition matches against the GitHub event that triggered the workflow. This corresponds to the event name in your workflow's on: section.
Every rule must specify an event - it's the only required condition field.
Syntax
when:
event: pull_request # RequiredSupported Events
| Event | Support | Description |
|---|---|---|
pull_request | ✅ Primary | PR opened, closed, edited, labeled, etc. Full PR context and all features. |
pull_request_review | ✅ Supported | PR review submitted, edited, dismissed. Full PR context extracted from payload. |
issues | ✅ Supported | Issue opened, closed, labeled, etc. Full issue context and task creation. |
pull_request_target | ⚠️ Limited | Similar to pull_request but runs in base branch context. |
push | ❌ Unsupported | No PR or issue context available. |
issue_comment | ❌ Unsupported | No PR or issue context available. |
TIP
pull_request, pull_request_review, and issues are the supported events. All provide full context and support all relevant features. The action returns early with a warning for any other event type.
For a complete list of GitHub events, see:
Examples
PR Event
Match any pull request event:
rules:
- when:
event: pull_request
then:
update_fields:
'1234567890': 'In Progress'PR Review Event
Update an Asana field when a pull request review is submitted:
rules:
- when:
event: pull_request_review
action: submitted
review_state: approved
then:
update_fields:
'1234567890': 'Code Approved'Issues Event
Create an Asana task when a GitHub issue is opened:
rules:
- when:
event: issues
action: opened
has_asana_tasks: false
then:
create_task:
project: '1234567890'
workspace: '0987654321'
title: 'GH Issue #{{issue.number}}: {{issue.title}}'
notes: '{{issue.body}}'Workflow Configuration
The event in your rule must match an event in your workflow's on: section. To handle PRs, PR reviews, and issues, listen for all relevant events:
# .github/workflows/asana-sync.yml
on:
pull_request:
types: [opened, closed, labeled, reopened, ready_for_review]
pull_request_review:
types: [submitted, edited, dismissed]
issues:
types: [opened, closed, labeled, reopened]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: planningcenter/asana-github-sync@main
with:
asana_token: ${{ secrets.ASANA_TOKEN }}
github_token: ${{ github.token }}
rules: |
rules:
- when:
event: pull_request
action: opened
draft: false
then:
update_fields:
'1234567890': 'In Review'
- when:
event: issues
action: opened
has_asana_tasks: false
then:
create_task:
project: '1234567890'
workspace: '0987654321'
title: 'Issue #{{issue.number}}: {{issue.title}}'Combining with Other Conditions
Use additional conditions to be more specific:
rules:
# PR-specific conditions
- when:
event: pull_request
action: opened
draft: false # PR-only condition
then:
update_fields:
'1234567890': 'In Review'
# Issue-specific rule
- when:
event: issues
action: opened
has_asana_tasks: false
then:
create_task:
project: '1234567890'
workspace: '0987654321'
title: '{{issue.title}}'PR-only conditions
The merged and draft conditions are PR-only — they will never match on an issues event, even if specified.
Validation Rules
- Required: Every rule must have an
event - Type: Must be a string
- Case-sensitive: Use lowercase (e.g.,
pull_request, notPull_Request)
Common Errors
Missing event
# ❌ Wrong - no event specified
when:
action: opened
then:
# ...
# ✅ Correct
when:
event: pull_request
action: opened
then:
# ...Wrong event name
# ❌ Wrong - workflow doesn't listen for 'push'
on:
pull_request:
rules:
- when:
event: push # This will never match!
then:
# ...See Also
- action - Filter by specific event actions
- review_state - Filter by review state (approved, changes_requested, commented)
- Workflow Triggers - All GitHub event types