
name: tvm-bot
on:
  issue_comment:
    types: [created]

concurrency:
  group: merge-${{ github.event.issue.number }}
  cancel-in-progress: true

jobs:
  run-tvm-bot:
    permissions:
      contents: write
      issues: write
      pull-requests: write
    if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '@tvm-bot ') && github.repository == 'apache/tvm' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6.0.2
      - name: Run tvm-bot
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GH_ACTIONS_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
          TVM_BOT_JENKINS_TOKEN: ${{ secrets.TVM_BOT_JENKINS_TOKEN }}
          PR_NUMBER: ${{ github.event.issue.number }}
          ISSUE_COMMENT: ${{ toJson(github.event.comment) }}
          RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
        run: |
          set -eux
          python ci/scripts/github/github_tvmbot.py --pr "$PR_NUMBER" --run-url "$RUN_URL" --trigger-comment-json "$ISSUE_COMMENT"
