name: Comments on GitHub issues

on:
  workflow_dispatch:
    inputs:
      payload:
        description: 'Serialized and escaped JSON describing what and where to comment.'
        required: true

jobs:
  comment:
    runs-on: ubuntu-22.04
    steps:
      - name: 👀 Checkout
        uses: actions/checkout@v3
      - name: ➕ Add `bin` to GITHUB_PATH
        run: echo "$(pwd)/bin" >> $GITHUB_PATH
      - name: ♻️ Restore caches
        uses: ./.github/actions/expo-caches
        id: expo-caches
        with:
          yarn-tools: 'true'
      - name: 💬 Comment on GitHub issues as github-actions bot
        run: expotools commentator --payload "${{ github.event.inputs.payload }}"
        env:
          GITHUB_TOKEN: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }}
