JavaScript Execution
Aviator allows for executing custom JS code with Pilot automated actions or the MergeQueue ready hook. Learn more details about how it happens in our guide.
Last updated
Was this helpful?
Aviator allows for executing custom JS code with Pilot automated actions or the MergeQueue ready hook. Learn more details about how it happens in our guide.
Last updated
Was this helpful?
Aviator has support for executing custom JavaScript code using or the .
For security and sandboxing purposes, The Pilot JavaScript execution does not provide most standard web APIs (such as fetch
). Instead, several integrations with , , and are provided.
Each Javascript code execution has maximum time limit of 10 seconds, and you can write arbitrary javascript within the bounds of provided APIs and context.
For each Javascript execution, Aviator provides the a few variables for global context. These variables can be used to query data or take action.
$aviator
or aviator
Represents the top level context. It has 3 properties: github
, slack
and mergequeue
. These properties can also be used directly with $github
, $slack
and $mergequeue
respectively. Example:
or
$github
Corresponds to the component, and can also be used directly. Example:
$slack
Corresponds to the component and can also be used directly. Example:
$mergequeue
console
Represents the standard javascript console. Although these console logs are not captured anywhere.
PullRequestEvent
Associated with a pull_request
trigger. It has a the following properties:
event.pullRequest
- a PullRequest
object
event.action
- string representing the action on the pull request.
event.sender
- a GitHubUser
object representing the user who took the action on the pull request
event.repository
- a GitHub
repository object
PullRequestReviewEvent
Associated with a pull_request_review
trigger. It has the following properties:
event.pullRequest
- a PullRequest
object
event.action
- string representing the action on the pull request.
event.sender
- a GitHubUser
object representing the user who took the action on the pull request
event.repository
- a GitHubRepository
object
event.review
- a Review
object
MergeQueueEvent
Associated with a merge_queue
trigger. It has the following properties:
event.pullRequest
- a PullRequest
object
event.action
- string representing the action on the pull request
event.repository
- a GitHubRepository
object
url
- string representing the URL of the pull request. E.g. https://github.com/aviator-co/mergeit/pull/6301
number
- integer representing PR number, e.g.: 6301
state
- string representing state of the PR, possible values: open
, pending
, queued
, blocked
and merged
user
- a GitHubUser
object representing the author of the PR
skipLine
- boolean. True when the PR is a skip-line label (associated with MergeQueue)
skipLineReason
- string (optional). If skip line reason was provided
id
- representing a unique identifier for a pull request. e.g. aviator-co/mergeit#6301
base
- a PullRequestRef
object representing the base branch of this PR.
head
- a PullRequestRef
object representing the head branch of this PR.
ref
- string representing a branch, e.g. master
login
- string representing the GitHub username
name
- string representing the name of the repository, e.g. mergeit
fullName
- string representing the org name and repository name together, e.g. aviator-co/mergeit
user
- The GithubUser
who submitted the review
body
- string representing the contents of the review
state
- string representing approved, changes_requested, commented
Corresponds to the component, and can be used directly. Example:
For each Javascript execution, Aviator also provides a local context associated with the trigger that caused the javascript to be executed. This is defined as event
object. An event can be of multiple types. Each represents one even type: