Aviator has support for executing custom JavaScript code using Pilot automated actions or the MergeQueue ready hook . For security and sandboxing purposes, The Pilot JavaScript execution does not provide most standard web APIs (such as
fetch
). Instead, several integrations with MergeQueue , GitHub , and Slack 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. Global 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: Copy
aviator.github.addLabel({ label: "urgent", target: event.pullRequest.id });
or Copy
$aviator.mergequeue.synchronizePullRequest({target: event.pullRequest.id});
$github
Corresponds to the GitHub component, and can also be used directly. Example: Copy
$github.addLabel({ label: "urgent", target: event.pullRequest.id });
$slack
Corresponds to the Slack component and can also be used directly. Example:
$mergequeue
Corresponds to the MergeQueue component, and can be used directly. Example:
console
Represents the standard javascript console. Although these console logs are not captured anywhere. Local Context 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 trigger event represents one even type:
PullRequestEvent
Associated with a
pull_request
trigger. It has a the following properties:
event.pullRequest
PullRequest
object
event.action
event.sender
GitHubUser
object representing the user who took the action on the pull request
event.repository
GitHub
repository object
PullRequestReviewEvent
Associated with a
pull_request_review
trigger. It has the following properties:
event.pullRequest
PullRequest
object
event.action
event.sender
GitHubUser
object representing the user who took the action on the pull request
event.repository
GitHubRepository
object
event.review
Review
object
MergeQueueEvent
Associated with a
merge_queue
trigger. It has the following properties:
event.pullRequest
PullRequest
object
event.action
event.repository
GitHubRepository
object Event Objects PullRequest
url
https://github.com/aviator-co/mergeit/pull/6301
number
6301
state
open
,
pending
,
queued
,
blocked
and
merged
user
GitHubUser
object representing the author of the PR
skipLine
skipLineReason
id
aviator-co/mergeit#6301
base
PullRequestRef
object representing the base branch of this PR.
head
PullRequestRef
object representing the head branch of this PR. PullRequestRef
ref
master
GitHubUser
login
name
mergeit
fullName
aviator-co/mergeit
Review
user
GithubUser
who submitted the review
body
state
approved, changes_requested, commented
Previous Scheduled Events Next Pilot Automated Actions Reference Last updated 1 year ago Was this helpful?