name: Test
on:
  repository_dispatch:
    types: [test-cmd]
jobs:
  blog:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'blog'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "${{ github.event.client_payload.slash_command.arg1 }}", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "staging:blog", "tag": "staging-blog", "url_prefix": "staging."}'
  dartdoc:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'dartdoc'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "${{ github.event.client_payload.slash_command.arg1 }}", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "staging:${{ github.event.client_payload.pull_request.base.ref }}", "tag": "staging-${{ github.event.client_payload.pull_request.base.ref }}", "url_prefix": "staging.${{ github.event.client_payload.pull_request.base.ref }}."}'
  design:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'design'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "${{ github.event.client_payload.slash_command.arg1 }}", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "staging:design", "tag": "staging-design", "url_prefix": "staging."}'
  fastlane:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'fastlane'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "fastlane", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "fastlane:test", "tag": "fastlane-test", "url_prefix": ""}'
  functions:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'functions'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "${{ github.event.client_payload.slash_command.arg1 }}", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "staging:${{ github.event.client_payload.pull_request.base.ref }}", "tag": "staging-${{ github.event.client_payload.pull_request.base.ref }}", "url_prefix": "staging.${{ github.event.client_payload.pull_request.base.ref }}."}'
  pioneer:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'pioneer'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "${{ github.event.client_payload.slash_command.arg1 }}", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "staging:pioneer", "tag": "staging-pioneer", "url_prefix": "staging."}'
  typedoc:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'typedoc'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "${{ github.event.client_payload.slash_command.arg1 }}", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "staging:${{ github.event.client_payload.pull_request.base.ref }}", "tag": "staging-${{ github.event.client_payload.pull_request.base.ref }}", "url_prefix": "staging.${{ github.event.client_payload.pull_request.base.ref }}."}'
  ui:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'ui'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "${{ github.event.client_payload.slash_command.arg1 }}", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "staging:ui", "tag": "staging-ui", "url_prefix": "staging."}'
  web:
    runs-on: ubuntu-latest
    if: github.event.client_payload.slash_command.arg1 == 'web'
    steps:
      - uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          event-type: deploy-cmd
          client-payload: '{"base": "${{ github.event.client_payload.pull_request.base.ref }}", "branch": "${{ github.event.client_payload.pull_request.head.ref }}", "comment_id": "${{ github.event.client_payload.github.payload.comment.id }}", "environment": "staging", "event_name": "${{ github.event.client_payload.slash_command.arg1 }}", "pull_request_number": "${{ github.event.client_payload.pull_request.number }}", "release": "false", "task": "staging:${{ github.event.client_payload.pull_request.base.ref }}", "tag": "staging-${{ github.event.client_payload.pull_request.base.ref }}", "url_prefix": "staging.${{ github.event.client_payload.pull_request.base.ref }}."}'
