Skip to content

A GitHub Action for setting up Pantheon's CLI tool, Terminus.

License

Notifications You must be signed in to change notification settings

pantheon-systems/terminus-github-actions

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Actively Maintained

Terminus GitHub Actions

A GitHub Action for quickly installing and configuring the Pantheon CLI tool, Terminus.

Usage

In order to avoid deprecation warnings, it's recommended to use the setup-php action rather than rely on the version of PHP that is installed by default on GH runners.

steps:
  - name: Setup PHP
    uses: shivammathur/setup-php@v2
    with:
      php-version: "7.4"

  - name: Install Terminus
    uses: pantheon-systems/terminus-github-actions@v1
    with:
      pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN }}

  - name: List sites
    run: terminus site:list

By default, this action installs the latest version of Terminus that has been released on GitHub. You can provide a specific version of Terminus to install using the terminus-version input:

steps:
  - name: Setup PHP
    uses: shivammathur/setup-php@v2
    with:
      php-version: "7.4"

  - name: Install Terminus
    uses: pantheon-systems/terminus-github-actions@v1
    with:
      pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN }}
      terminus-version: 2.6.5

  - name: List sites
    run: terminus site:list

This action will encrypt and cache the Terminus session by default to be re-used across jobs in a workflow to reduce the number of authorizations. If you need to disable this for some reason, you can set the disable-cache option to true.

steps:
  - name: Install Terminus
    uses: pantheon-systems/terminus-github-actions@v1
    with:
      pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN }}
      disable-cache: true

Please note that in order to run commands that require SSH (e.g. drush or wp-cli), you will need to setup a SSH key. There are plenty of options available in the Github Actions Marketplace. We recommend you to choose one of them and use them in your pipeline.

Diagram

graph TD

subgraph Setup Terminus GitHub Action
  A[Start] --> B{inputs.terminus-version}
  B --> |Yes| C[Set TERMINUS_RELEASE to inputs.terminus-version]
  B --> |No| D[Get latest Terminus release from GitHub API]
  D --> E[Set TERMINUS_RELEASE to latest version]
  C --> F[Install Terminus]
  E --> F
  F --> G[Cache Terminus Directory]
  G --> H{inputs.pantheon-machine-token}
  H --> |Yes| I[Login to Pantheon]
  H --> |No| J[End]
  I --> J
end

style A fill:#f9f,stroke:#333,stroke-width:2px;
style J fill:#f9f,stroke:#333,stroke-width:2px;

Loading

Credits

Big thanks to Gareth Jones and Ackama for the initial development work.