From 589117a35e0f56e3f00a2477386f47669a612a42 Mon Sep 17 00:00:00 2001 From: liaou3 Date: Fri, 5 Apr 2024 23:08:56 +0800 Subject: [PATCH] Leave a comment after a PR been created --- .github/workflows/test_market_time.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_market_time.yaml b/.github/workflows/test_market_time.yaml index 618dab4..8e54fbe 100644 --- a/.github/workflows/test_market_time.yaml +++ b/.github/workflows/test_market_time.yaml @@ -26,8 +26,21 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt # 如果有必要的話,根據您的專案設置來安裝相關的依賴 - + pip install -r requirements.txt - name: Run tests run: | python -m unittest tests/test_market_time.py + + - name: Add test results to PR + if: github.event_name == 'pull_request' + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const results = `Test results:\n${process.env.unittests}`; + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: results + })