[Feature]: !default直接拼接所有预设内容,过长发送失败 #418
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Pull Request | |
on: | |
pull_request: | |
types: [ready_for_review] | |
paths: | |
# 任何py文件改动都会触发 | |
- '**.py' | |
pull_request_review: | |
types: [submitted] | |
issue_comment: | |
types: [created] | |
# 允许手动触发 | |
workflow_dispatch: | |
jobs: | |
perform-test: | |
runs-on: ubuntu-latest | |
# 如果事件为pull_request_review且review状态为approved,则执行 | |
if: > | |
github.event_name == 'pull_request' || | |
(github.event_name == 'pull_request_review' && github.event.review.state == 'APPROVED') || | |
github.event_name == 'workflow_dispatch' || | |
(github.event_name == 'issue_comment' && github.event.issue.pull_request != '' && contains(github.event.comment.body, '/test') && github.event.comment.user.login == 'RockChinQ') | |
steps: | |
# 签出测试工程仓库代码 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
# 仓库地址 | |
repository: RockChinQ/qcg-tester | |
# 仓库路径 | |
path: qcg-tester | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
cd qcg-tester | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Get PR details | |
id: get-pr | |
if: github.event_name == 'issue_comment' | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set PR source branch as env variable | |
if: github.event_name == 'issue_comment' | |
run: | | |
PR_SOURCE_BRANCH=$(echo '${{ steps.get-pr.outputs.data }}' | jq -r '.head.ref') | |
echo "BRANCH=$PR_SOURCE_BRANCH" >> $GITHUB_ENV | |
- name: Set PR Branch as bash env | |
if: github.event_name != 'issue_comment' | |
run: | | |
echo "BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV | |
- name: Set OpenAI API Key from Secrets | |
run: | | |
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV | |
- name: Set OpenAI Reverse Proxy URL from Secrets | |
run: | | |
echo "OPENAI_REVERSE_PROXY=${{ secrets.OPENAI_REVERSE_PROXY }}" >> $GITHUB_ENV | |
- name: Run test | |
run: | | |
cd qcg-tester | |
python main.py | |
- name: Upload coverage reports to Codecov | |
run: | | |
cd qcg-tester/resource/QChatGPT | |
curl -Os https://uploader.codecov.io/latest/linux/codecov | |
chmod +x codecov | |
./codecov -t ${{ secrets.CODECOV_TOKEN }} |