Table of Contents
The GitHub integration allows you to manage your SymfonyCloud environments directly from your GitHub repository.
- Create a new environment when creating a branch or opening a pull request on GitHub.
- Rebuild the environment when pushing new code to GitHub.
- Delete the environment when merging a pull request.
To integrate your project with an existing GitHub repository, you first need to generate a new token.
Give it a description and then ensure the token has the following scopes:
- To integrate with public repositories:
- To integrate with your own private repositories:
- To integrate with your organization's private repositories:
Copy the token and make a note of it (temporarily).
For the integration to work, your GitHub user needs to have permission to push code to the repository.
Enable the GitHub integration as follows:
$ symfony integration:add --type=github --repository=USER/REPOSITORY
USERis your GitHub username or organization
REPOSITORYis the name of the repository in GitHub (not the git address)
--fetch-branches: Track and deploy branches (
--prune-branches: Delete branches that do not exist in the remote GitHub repository (
--build-pull-requests: Track and deploy pull-requests (
falseto have SymfonyCloud build the branch specified in a PR.
trueto build the result of merging the PR (
--pull-requests-clone-parent-data: Set to
falseto disable cloning of parent environment data when creating a PR environment, so each PR environment starts with no data. (
When successful, the previous command outputs the configuration for the integration.
- Copy the hook URL shown in the summary table.
- Go to your GitHub repository, click
Settings, select the
Webhooks and Servicestab, and click
- Paste the hook URL, choose
application/jsonfor the content type, choose
Send me everythingfor the events you want to receive, and click
You can now start pushing code, creating new branches or opening pull requests directly on your GitHub repository.
Environments based on GitHub pull requests will have the correct "parent"
environment on SymfonyCloud and they will be activated automatically with a copy
of the parent's data (unless the option
However, environments based on (non-pull-request) branches cannot have parents; they will inherit directly from the production environment and start inactive by default.