name: "Build Chat"

on:
  workflow_run:
    workflows:
      - CI
    types:
      - completed
    branches:
      - master
      - release/*

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Setup Node.js 12.x
      uses: actions/setup-node@v1.4.4
      with:
          node-version: "12.x"

    - name: Build
      run: yarn install && yarn run build
      working-directory: .github/actions/build-chat

    - name: Build Chat
      uses: ./.github/actions/build-chat
      with:
        workflow_run_url: ${{ github.event.workflow_run.url }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
        BUILD_CHAT_STORAGE_CONNECTION_STRING: ${{ secrets.BUILD_CHAT_STORAGE_CONNECTION_STRING }}