Pantheon's GitHub Actions
Actions for web teams and plugin authors
Pantheon maintains multiple GitHub Actions for integrating with our platform or designed for authors of WordPress plugins and other packages. This page focuses on the two actions most commonly used by web teams deploying to Pantheon.
Push to Pantheon
Our Push to Pantheon Action handles the creation of Multidev environments that correspond to GitHub pull requests and the pushes to Pantheon's Dev environment after merging pull requests to a main
branch.
When running workflow triggered by a pull request, this action will create a Multidev environment and deploy code to it.
When running on workflows triggered by merges/pushes to the main
branch (or whatever you name your default branch) this action will deploy code to the Pantheon Dev environment.
Here is an example of a complete GitHub Actions workflow file to deploy every pull request made on the repository for a WordPress or Drupal site codebase to a Pantheon Multidev environment.
name: Deploy PR to Pantheon
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: false
on:
pull_request:
types: [opened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Push to Pantheon
uses: pantheon/push-to-[email protected]
with:
ssh_key: ${{ secrets.PANTHEON_SSH_KEY }}
machine_token: ${{ secrets.PANTHEON_MACHINE_TOKEN }}
site: ${{ vars.PANTHEON_SITE_MACHINE_NAME }}
For more detailed usage guidance including availabile parameters, compilation of front-end assets through npm
, and concurrency, see the full readme file from the Action.
Install Terminus
If you are writing your own GitHub Actions workflows from scratch to interact with Pantheon, you will likely need to install Terminus in your workflow. (The above Push to Pantheon Action calls Terminus installation for you). This is a simple Action that can be added to your workflow file.
- name: Install Terminus
uses: pantheon-systems/terminus-github-actions@v1
with:
pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN }}
This Action also handles caching of both the Terminus executable and of the authenticated session which is valuable when running complex workflows across dozens or hundreds of sites. See the readme for more details.