LogoLogo
HomeAbout usSign up
  • Introduction
  • AttentionSet
    • AttentionSet Best Practices
    • How to View AttentionSet for Others
    • How to Manually Change Attention
    • AttentionSet Chrome extension
    • Attention reasons
    • AttentionSet Slack Home Page
  • Releases
    • Getting Started with Releases
    • Concepts for Releases
      • Terminology for Releases
      • Two-step delivery
      • Rollbacks
      • Cherry-picks
      • Dogfood, Canary and Rollout
      • Release notes
    • How-to Guides for Releases
      • How to Create a Release Project
      • How to Configure Environments
      • How to Create a Scheduled Release
      • Create Custom Workflow Parameters
      • How to Manage Cherry-Picks
      • How to Resolve a Cherry-Pick Failure
      • Working with your CI / CD
        • GitHub Actions workflow
        • Buildkite workflow
    • API Reference for Releases
  • FlexReview
    • Getting Started with FlexReview
    • How to Onboard a Large Org
    • Concepts for FlexReview
      • Read-Only Mode in FlexReview
      • Recursive Ownership in FlexReview
      • Reviewer suggestion and assignment
      • FlexReview Teams and SLO Management
      • Validation in FlexReview
    • How-to Guides for FlexReview
      • How to Get a Reviewer Suggestion
      • How to Exclude Reviewers
      • How to Set Up Team Rules
      • Whitelist Teams for Review Assignment
      • Troubleshoot Reviewer Assignment
      • PagerDuty Integration for Reviewers
      • How to Set Up FlexReview Validation
      • Recommended Slack Notification Settings
      • How to Exclude OOO Reviewers
    • FlexReview Reference
      • Configuration
      • Slash commands
      • Expert scoring algorithms
      • Slack Notifications
      • Out of Office User Exclusion
    • FlexReview Roadmap
  • MergeQueue
    • Getting Started with MergeQueue
    • Merge Rules
    • How-to Guides for MergeQueue
      • How to Configure Base Branches
      • How to Customize Required Checks
      • How to Set Up Fast-Forwarding
      • How to Set Up Pre-Queue Conditions
      • How to Queue / Dequeue via API
      • Pause / Unpause Queues via API
      • Slash Commands Using GitHub Comments
      • How to Customize Sticky Comments
      • Require an Aviator Status Check
      • Backport a PR
      • How to Configure ChangeSets
      • Custom Integrations
        • GitHub Integration
      • How to Create Personal Access Tokens
      • How to Set Up SAML Configuration
        • Microsoft Active Directory
      • How to Merge Stacked PRs
      • How to Block Pull Request Mergeing with Slash Commands
    • Concepts for MergeQueue
      • Queue Modes
      • Pull Request Lifecycle
      • Analytics
      • Parallel Mode
      • CI Status Requirements
      • MQ Created Branches
      • Batching
      • Managing flaky tests
      • Fast-forwarding
      • Pre-Queue Conditions
      • Sticky Comments
      • Backporting
      • Paused Queues
      • Affected Targets
        • Directory-Based Affected Targets
        • nx based affected targets
        • GitHub Actions based Affected Targets
      • ChangeSets
        • Global CI Validation
        • ChangeSets FAQs
      • Priority Merges
        • Instant Merges
      • Merge Rules Audit Trail
      • Timeline
      • Ready Hook
      • Reduce Queue Failures From Staleness
    • MergeQueue References
      • Configuration Schema
      • Configuration Reference MergeQueue
      • GitHub Slash Commands
      • Status Codes
  • Stacked PRs CLI
    • Quickstart for Stacked PRs CLI
    • CLI Installation
    • How-to Guides for Stacked PRs CLI
      • How to Create Stacked PRs in CLI
      • How to Navigate & Modify Stacked PRs
      • Add Commits in the Stack
      • How Split a Commit in CLI
      • How to Split and Fold Pull Requests
      • How to Rename a Branch in CLI
      • How to Adopt a Branch in CLI
      • Orphan a Branch with Aviator CLI
      • How to Do Git Subcommand Aliasing
      • How to Create an Access Token
      • How to Set Up Auto Completion in CLI
      • How to Use Editor Plugins in CLI
    • Concepts for StackedPRs CLI
    • How to Rebase and Sync with GitHub
    • Configuration for StackedPRs CLI
    • Stacked PRs FAQs and Troubleshooting
      • Working with Aviator CLI
      • Default Branch Update Master to Main
    • Manpages for Stacked PRs CLI
      • av(1)
      • av-adopt Command Guide
      • av-auth-status(1) in CLI
      • av-stack-branch(1) in CLI
      • av-commit-create(1) in CL
      • av-stack-diff(1) in CLI
      • av-fetch(1) in CLI
      • av-git-interaction Command Guide
      • av-init(1) in CLI
      • av-stack-next(1) in CLI
      • av-orphan Command Guide
      • av-pr-status(1) in CLI
      • av-pr-create(1) in CLI
      • av-stack-prev(1) in CLI
      • av-stack-reorder(1) in CLI
      • av-reparent Command Guide
      • av-restack Command Guide
      • av-commit-split(1) in CLI
      • av-switch Command Guide
      • av-stack-sync(1) in CLI
      • av-stack-tidy(1) in CLI
      • av-stack-tree(1) in CLI
    • Aviator CLI Major Releases
      • Aviator CLI v0.1.0 Release Notes
  • Aviator's Chrome Extension
  • Pilot Automated Actions
    • Scheduled Events
    • JavaScript Execution
    • Pilot Automated Actions Reference
      • GitHub Reference
      • MergeQueue Reference
      • Slack Reference
  • API and Integrations
    • Slack Integration Guide
    • GraphQL API Quickstart
    • Prometheus Metrics Setup for GCP
    • Reference
      • JSON API
      • GraphQL
      • Webhooks
      • Monitoring Metrics
  • Manage
    • Access Management
    • GitHub App Permissions
    • Security
      • Aviator Agents Data Usage & Retention Policy
    • On-Premise Installation
      • GitHub App for On-Prem
      • GitHub OAuth for On-Prem
      • Use Helm Instructions
      • Use Docker Compose Instructions
      • Prometheus endpoint
      • Slack Integration for On-Premise
      • Google SSO Login for On-Prem
    • FAQs
      • Troubleshooting GitHub app connection
      • MergeQueue FAQs
      • Billing FAQs
Powered by GitBook
On this page
  • Scenarios
  • Triggers
  • Actions

Was this helpful?

Pilot Automated Actions

Aviator offers automated actions you can configure to perform specific actions depending on an event or scenario. Learn how to write custom scenarios here.

Aviator offers automated actions that can be configured via the configuration file to perform specific actions depending on a particular event or scenario. You can write your own custom scenarios and corresponding actions in the configuration file.

Each Pilot workflow contains one scenario and one or more actions. Here’s an example of a simple scenario:

scenarios:
  - name: "instant merge"
    trigger:
      pull_request:
        labeled: "av-instant-merge"
    actions:
      - mergequeue:
          instant_merge: {}

In the above example, we are triggering an instant merge action based on the label av-instant-merge.

Scenarios

A scenario is a configurable, automated process that is invoked in response to a certain trigger and which in turn may run several actions. Scenarios are often phrased in English as “if this, then that.”

In the configuration file, the scenarios object has three properties

  • name - a readable name that uniquely identifies a particular scenario

  • trigger - represents an object and an associated event that will trigger this scenario

  • actions - a list of actions that will be triggered in order when the trigger scenario condition is met.

Triggers

Each trigger is associated with a context of an object. Currently we support the following types of contexts:

pull_request

It has the following associated events:

  • opened: represents when the PR is opened

trigger:
  pull_request: opened
  • labeled: when a GitHub label is added to the PR

trigger:
  pull_request:
    labeled: "av-instant-merge"

You can also specify who labeled the PR or who the author is. Here a GitHub username can be provided. If you want to instead represent a team, you can use @org/team. Exactly one of github_login and github_team must be specified.

trigger:
  pull_request:
    labeled:
      label "av-instant-merge"
      labeled_by: ghusername
trigger:
  pull_request:
    labeled:
      label "av-instant-merge"
      authored_by: “@aviator-co/engineering”
  • synchronize: The PR was synchronized. This means that the pull request either had new commits pushed to it, was force-pushed, or had its base branch changed.

trigger:
  pull_request: synchronize
  • submitted: The PR is ready for review.. This means that it was either opened, or switched from draft to ready for review.

trigger:
  pull_request: submitted

Note that both submitted and opened events will be triggered when a PR is directly opened in review mode (as non-draft).

pull_request_review

Associated events:

  • approved: The PR review provided was of approved type.

trigger:
  pull_request_review: approved

mergequeue

Associated events:

  • ready: A user requested a PR to be queued. This is triggered at the same time as the pullrequest.labeled action if the PR was queued using a GitHub label.

trigger:
  mergequeue: ready
  • queued: A PR was added to the queue.

    • skip_line [optional]: A PR marked to skip the line was added to the queue.

trigger:
  mergequeue: queued

To add the skip_line option:

trigger:
  mergequeue: 
    queued:
      skip_line: true
trigger:
  mergequeue: dequeued
  • added_to_batch: A PR was added to batch for validation. This is applicable only for parallel mode. This will still be called even if the draft PR was skipped due to skip_draft_when_up_to_date config setting in the parallel mode.

trigger:
  mergequeue: added_to_batch
  • removed_from_batch: A PR was removed from the validation batch. This is applicable only for parallel mode. This will still be called even if the draft PR was skipped due to skip_draft_when_up_to_date config setting in the parallel mode.

trigger:
  mergequeue: removed_from_batch
  • top_of_queue: A new PR reached the top of the queue.

trigger:
  mergequeue: top_of_queue
  • merged: A PR was merged.

trigger:
  mergequeue: merged
  • blocked: A PR was blocked by Aviator.

trigger:
  mergequeue: blocked
  • stuck: A PR was marked as stuck by Aviator.

trigger:
  mergequeue: stuck
  • reset: The queue was reset.

trigger:
  mergequeue: reset

schedule

Used to trigger scheduled events. Please read Scheduled Events for examples.

Actions

You can specify one or more actions to be executed based on the triggers specified in the scenarios. These actions are performed serially in the order specified and are executed in the context of the trigger. For instance, if we specify the labeled event for a pull_request in the trigger, then the associated action can be performed on the same PR that was labeled.

There are a few types of actions.

github

These include actions to add a label or add a reviewer.

  • add_label - Add a GitHub label to the PR. You can directly pass it the label name.

  • remove_label - Remove the provided GitHub label from the PR. If the label doesn't exist, this action will be a no-op.

  • add_reviewer - Add a reviewer to the PR. You can directly pass the username or a team name (@org/team) as a parameter to this action.

actions:
  - github:
    add_label: urgent
  - github:
    remove_label: urgent
  - github:
    add_reviewer: ghusername  # or “@org/team”

mergequeue

actions:
  - mergequeue: queue
  - mergequeue:
    instant_merge: {}

There's also the ability to pause and unpause. By default, the entire repository (including all base branches) will be paused/unpaused.

actions:
  - mergequeue: pause
  - mergequeue: unpause

You can also specify a branch_pattern or a paused_message, both of these fields are optional.

actions:
  - mergequeue:
    pause:
      branch_pattern: release-*
      paused_message: "The release branch is paused while we wait on a fix."
  - mergequeue:
    unpause:
      branch_pattern: release-*

slack

  • channel: Send notification to a Slack channel.

    • text: The text to send in the notification.

    • hook_url [optional]: The webhook URL for a Slack channel. If not provided, the default channel set up with the Slack integration will be used.

  • direct: Send a Slack DM to a user directly.

    • text: The text to send in the notification.

    • github_users [optional]: The GitHub users to notify (must be the GitHub username associated with the user). If not specified, the notification will be sent to the author of the PR.

    • github_group [optional]: The GitHub group whose members will be notified.

    • labels [optional]: Labels associated with this Slack DM that users can utilize to personalize DMs. By default, all specified users (either github_users, github_group, or the author of the PR will be notified). If you want to opt-out, see Personal Integrations.

    • opt-in [optional]: If True, then the users will need to voluntarily opt-in to receive the DM.

actions:
  - slack:
      channel:
        text: “A new PR has been posted”
        hook_url: “https://hooks.slack.com/services/xxxxxxxxxxxxxxxxx”
  - slack:
      direct:
        text: “A new PR has been posted”
        github_users:
          - login: ghusername1
          - login: ghusername2
        github_group: "eng/infrastructure"

script

If you want more custom controls over the actions, you may also choose to write a custom script using Javascript. All the other actions described above can be triggered via script as well. Here’s a quick example:

actions:
  - script:
      code: |
        console.log("hello", "world", event, event.target, event.pullRequest.number);
        aviator.github.addLabel({ label: "urgent", target: event.pullRequest.id });

The following attributes are accessible via the event variable.

  • pullRequest

    • url: The URL of the pull request.

    • number: The number of the pull request. (ex. event.pullRequest.number)

    • state: The state of the pull request. If the trigger is a pull_request trigger, options are: open, closed. If the trigger is a mergequeue trigger, options are: open, queued, blocked, merged, tagged.

    • labels: Labels that are on the pull request.

    • user

      • login: The GitHub login of the user who opened the pull request.

    • skipLine (mergequeue trigger only): [boolean] Whether the pull request was queued with skip line.

    • skipLineReason (mergequeue trigger only): The skip line reason for a pull request if it was given. (ex. event.pullRequest.skipLineReason)

  • repository

    • name: The name of the repository. (ex. event.repository.name)

    • full_name: The full name of the repository, including the organization name, in the format org/repo_name.

PreviousAviator's Chrome ExtensionNextScheduled Events

Last updated 1 year ago

Was this helpful?

cron_utc - required string parameter. Accepts a . You can use a cron visual tool like for building your cron string.

Used to interact with Aviator’s merge queue. The queue action will enqueue the PR and instant_merge will merge the PR instantly. You can read more about instant merge behavior .

Send a Slack notification to the connected Slack account. Note that this requires to be active.

blocks [optional]: Customized Slack blocks to send in the notification. .

unix cron format
crontab.guru
Slack integration
See Slack's block building kit
here