added

GitHub Actions Custom Event Support

4772

You can now trigger GitHub Actions Workflows based on mabl test insights, powered by the mabl GitHub app. This allows you to create custom workflows to meet your specific business needs.

When mabl generates an insight about a recent deployment, it will deliver a custom event to your repository. This may be used in your workflow to take any relevant action, like creating a custom Issue, or rolling back a deployment.

Steps to use:

  1. Ensure the mabl GitHub app is installed on your workspace/repository
  2. Create a deployment event or use the mabl GitHub Run Tests Action
  3. mabl will run the associated tests and process the results for any potential insights
  4. If an insight is created, it will be delivered to the source repo as a mabl_insight event

The example workflow below demonstrates running custom code in your repo when an insight is created.

# Located in .github/workflows/mabl-insight-workflow.yml
name: Custom mabl insight workflow
# This workflow is triggered on new mabl insights
on: [repository_dispatch]

jobs:
  build:
    name: Process mabl insight
    runs-on: ubuntu-latest
    steps:
      # Print information about the mabl insight
      - name: Print insight details
        run: echo 'id:${{ github.event.client_payload.insight.id }} type:${{ github.event.client_payload.insight.insight_type }}'

The parsed payload in the github.event property (above) will be the following format:

📘

Beta Feature

Custom Actions events is a new feature under rapid development. The below payload may change as the underlying GitHub APIs move out of beta. mabl will strive to only make additive changes.

{
  "event_type": "mabl_insight",
  "client_payload": {
    "insight": {
      "id": "ou4EwnqlYjWjYdUiThcyyA-i",
      "insight_type": "plan_execution",
      "status": "broken",
      "browser_types": [
        "chrome"
      ],
      "screenshot_url": "<a screenshot url>",
      "message": "1 of 1 journeys failed",
      "plan_run": {
        "id": "BSOXw1ZjFpl1FhqigOOFIw-pr"
      },
      "application": {
        "id": "guOXw1ZjFpl1FhqigOOFxu-a"
      },
      "environment": {
        "id": "p2OXsdfjFpl1FhqigOOFTy-e"
      },
      "deployment": {
        "id": "PkkGy73fQG7yV1exJI7rfw-d"
      },
      "plan": {
        "name": "PetStore Canaries",
        "id": "hv6MgOqF-WECo1UXbEWjww-p",
        "url": "https://app.mabl.com/workspaces/Li3Xw1ZjFpl1FhqigOOyRu-w/test/plans/hv6MgOqFi3ECo1UXbEWjww-p"
      },
      "workspace": {
        "name": "My Favorite Workspace",
        "id": "55caed01-9135-4640-92b6-4ff8d68662fa",
        "url": "https://app.mabl.com/workspaces/Li3Xw1ZjFpl1FhqigOOyRu-w/monitor"
      },
      "starting_url": {
        "url": "https://www.acme.com/canary.html"
      }
    }
  }