Skip to content

fix(search): hide unready Tavily WebSearch #434

fix(search): hide unready Tavily WebSearch

fix(search): hide unready Tavily WebSearch #434

name: Copilot auto review
on:
pull_request_target:
types: [opened, reopened, ready_for_review, synchronize]
permissions: {}
concurrency:
group: copilot-auto-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
request-review:
if: >-
github.event.pull_request.draft == false &&
!endsWith(github.event.pull_request.user.login, '[bot]') &&
!contains(github.event.pull_request.labels.*.name, 'copilot-skip')
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# pull_request_target exposes the repository secret to fork PR events.
# Never checkout, execute, or otherwise consume untrusted PR code here.
- name: Request GitHub Copilot review
env:
GH_TOKEN: ${{ secrets.COPILOT_REVIEW_TOKEN }}
EXPECTED_REVIEW_REQUESTER: hqhq1025
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
if [[ -z "${GH_TOKEN:-}" ]]; then
echo "::error::COPILOT_REVIEW_TOKEN is not configured"
exit 1
fi
review_requester="$(gh api user --jq '.login')"
if [[ "${review_requester}" != "${EXPECTED_REVIEW_REQUESTER}" ]]; then
echo "::error::COPILOT_REVIEW_TOKEN belongs to ${review_requester}, expected ${EXPECTED_REVIEW_REQUESTER}"
exit 1
fi
if gh api \
"repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/requested_reviewers" \
--jq '.users[].login' | \
grep -Fxq 'copilot-pull-request-reviewer[bot]'; then
exit 0
fi
gh api \
--method POST \
"repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/requested_reviewers" \
-f 'reviewers[]=copilot-pull-request-reviewer[bot]'