Plan and Apply from PR comments

Invoking environment deployment flows directly from Pull Requests' comments.

As software developers, we all use a Version Control System (VCS) as the main tool in our process. With env0 you can also manage your Infrastructure as Code (IaC) deployments directly from your VCS provider.
By commenting with env0 commands on a pull request, it is possible to interact with your env0 environments without the need to login to the env0 platform.


In order to configure this feature, you will have to set an alias for your environment. This can be done in Environments > Settings > Run PR Comments Commands using an Alias.
You need to set an alias for each environment that you would like to enable this feature. This alias will be used to uniquely identify the environment when running a command from your VCS provider.
Environment alias may only contain letters, numbers, _, and -.



Role Based Access

Pay attention that when enabling this feature, anyone that can comment on the pull request can trigger a plan and an apply command, regardless of their role and access level in env0, making your VCS provider determine the RBAC in this case.


VCS provider support

We currently support the following VCS providers:

  1. GitHub
  2. Bitbucket Cloud
  3. Bitbucket Server
    We intend to support all VCS providers in the near future.

Supported env0 commands:

env0 help command

ā„¹ļø Ā  env0 help - lists all available commands.


env0 list command

šŸ”¢ Ā  env0 list - returns a list of all available environments and their aliases you can plan and apply in env0.


env0 plan command

šŸ”‚ Ā  env0 plan -e {environments aliases} - runs a plan on the env0 environments aliases. Aliases can be comma-separated if you like to run more than one environment.


env0 apply command

āÆļø env0 apply -e {environments aliases} - runs apply on the env0 environments aliases. Aliases can be comma-separated if you like to run more than one environment.


Apply Requirements

The apply command also verifies that the pull request has the following requirements:

  1. GitHub - We won't run the apply command if you have a protected branch in place and all the requirements are not met. You can read more about protected branch here.
  2. Bitbucket / Bitbucket Server - We verify that at least one person who isn't the author of the PR approved the pull request, and none of the participants requested changes. You can learn more about reviewing a pull request in bitbucket and decline a pull request.