| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: comment-bot |
| on: |
| pull_request_target: |
| types: [opened, reopened, edited, ready_for_review, labeled] |
| status: |
| |
| concurrency: |
| group: pr-comment-${{ github.event.number }}-${{ github.event.target_url }} |
| cancel-in-progress: true |
| |
| jobs: |
| run-comment-bot: |
| if: ${{ github.repository == 'apache/tvm' }} |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v2 |
| - name: Comment bot comment (pr) |
| if: ${{ github.event.number }} |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| PR_NUMBER: ${{ github.event.number }} |
| run: | |
| set -eux |
| python ci/scripts/github/github_pr_comment.py --pr "$PR_NUMBER" |
| - name: Comment bot comment (status) |
| if: ${{ github.event.state }} |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| URL: ${{ github.event.target_url }} |
| run: | |
| set -eux |
| if [[ "$URL" == *"PR-"* ]]; then |
| echo "PR status, sending comment" |
| PR_NUMBER=$(echo $URL | sed 's/.*PR-//g' | sed 's/\/.*//g') |
| python ci/scripts/github/github_pr_comment.py --pr "$PR_NUMBER" || /bin/true |
| else |
| echo "Not a PR status, skipping" |
| fi |