Diffy documentation
  • Features
    • 👋Welcome
    • Mask & Exclude
    • JavaScript snippets
    • HTTP headers
    • Cookies
    • CSS overrides
    • Mock content
    • Dealing with Dynamic Elements
      • Freeze Carousels / Sliders
      • Cookies Policy Popups
    • Configure project from YAML file
    • Zapier integration (JIRA, Trello, Basecamp integrations)
    • Bypass protection Cloudfront, Akamai, Incapsula
      • Bypass Akamai protection
      • Bypass Imperva Incapsula protection
    • Tags
    • Figma
    • Local development
      • DDEV add-on
      • Lando integration
      • Standalone docker container
      • Ngrok
  • Automation
    • 💡Overview
    • GitHub Pantheon CircleCI
    • GitHub Pantheon GitHub Actions
    • GitHub Tugboat
    • Platformsh GitHub Action
  • Tutorials
    • Comparison review
Powered by GitBook
On this page
  1. Automation

Platformsh GitHub Action

PreviousGitHub TugboatNextComparison review

Last updated 17 hours ago

Platformsh is a hosting platform that is very flexible in spinning up environments from git branches and pull requests.

Diffy can be integrated so that it visually compares each pull request with whatever environment you like. In our example, we compare it with production. You can watch a in the bottom of the page.

Complete steps to set up the integration are:

  • Set up Platformsh

  • Create a project in Diffy, specify the production environment

  • Under Project settings > Notifications > Github add URL of your GitHub repo and enable the Diffy GitHub app

  • Create an

  • Populate DIFFY_API_KEY and DIFFY_PROJECT_ID as

  • Create a GitHub action with the following code

name: "DiffyPullRequestTest"
run-name: "DiffyPullRequestTest"
on:
  pull_request:
    branches:
      - main

jobs:
  trigger-diffy-job:
    runs-on: ubuntu-latest
    steps:
      - name: 'Wait for psh and get target url'
        id: get-target-url
        uses: platformsh/gha-retrieve-psh-prenv-url@main
        with:
            github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: 'Install and Run Diffy'
        id: install-diffy-cli
        shell: bash
        env:
          diffy_api_key: '${{ secrets.DIFFY_API_KEY }}'
          diffy_project_id: '${{ secrets.DIFFY_PROJECT_ID }}'
        run: |
          wget -O /usr/local/bin/diffy https://github.com/diffywebsite/diffy-cli/releases/latest/download/diffy.phar
          chmod a+x /usr/local/bin/diffy
          diffy auth:login $diffy_api_key
          diffy project:compare $diffy_project_id prod custom --env2Url="${{ steps.get-target-url.outputs.target_url }}" --commit-sha="${{ github.event.pull_request.head.sha }}"

Once all this is done and GitHub action is merged, you create a pull request with visual changes and see how Diffy gets triggered and posts results back to the pull request.

video overview
Github integration
API key in Diffy
secrets in the GitHub repo
Diffy GitHub check