Skip to main content

GitHub Pull Request Integration

Overview

GitHub Pull Request Integration can be used to tie a Sandbox to the lifecycle of a Github Pull Request. The Sandbox is automatically deleted when the Pull Request is closed.

To set up the integration with GitHub, you will need to initiate the integration workflow through the Signadot Dashboard under Settings > Integrations. This will guide you to install the Signadot GitHub application into your GitHub organization.

Once the integration has been set up, it can then be used in the sandboxes you create using Sandbox Labels.

Specification

Two special label keys can be used to specify the association with a GitHub pull request. These labels are:

Label KeyValueExample
signadot/github-repopath of github repository (org/repo)signadot/community
signadot/github-pull-requestpull request number"123"

Example

To make use of this integration, typically you will want to add the above template variables to the sandbox specification stored under .signadot in your repository. An example specification is written as shown below:

name: pr-xyz-@{github-pr}
spec:
cluster: signadot-staging
description: sandbox for @{github-pr}
labels:
signadot/github-repo: "github-org/github-repo"
signadot/github-pull-request: "@{github-pr}"
forks:
- forkOf:
kind: Deployment
namespace: workspaces
name: web
customizations:
images:
- image: "myrepo/image:@{tag}"
defaultRouteGroup:
# ...

If you're using Github actions, the invocation of the sandbox create/update looks like the following:

docker run -i \
-e SIGNADOT_ORG="your-signadot-org" \
-e SIGNADOT_API_KEY=${{ secrets.SIGNADOT_API_KEY }} \
signadot/signadot-cli \
/signadot sandbox apply \
--set tag=${{ github.sha }} \
--set github-pr=${{ github.event.number }} \
-f - \
-o json \
< ${GITHUB_WORKSPACE}/.signadot/sandbox-template.yaml \
> ${GITHUB_WORKSPACE}/.signadot/sandbox-response.json

You may also invoke the same integration through the Signadot API by passing the same label parameters shown above.