From 5010e920bd7fcb54c54ab1858872f5d1b14304ee Mon Sep 17 00:00:00 2001 From: Akintola Rahmat Date: Fri, 12 Jul 2024 12:27:46 +0000 Subject: [PATCH] remove comments from coverage.yml file --- .github/workflows/ci.yml | 12 ++---------- .github/workflows/coverage.yml | 18 ++++++++---------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 072d03b6..b1b5bed6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,3 @@ -# .github/workflows/ci.yml name: CI on: @@ -15,14 +14,9 @@ jobs: matrix: python-version: [ 3.8, 3.9, "3.10", "3.11" ] permissions: - # Gives the action the necessary permissions for publishing new - # comments in pull requests. pull-requests: write - # Gives the action the necessary permissions for pushing data to the - # python-coverage-comment-action branch, and for editing existing - # comments (to avoid publishing multiple comments in the same PR) contents: write - uses: + steps: - uses: actions/checkout@v3 with: @@ -43,7 +37,7 @@ jobs: poetry config virtualenvs.path ~/.virtualenvs3.11 - name: Install dependencies - run: poetry install -E minify + run: poetry install - name: Launch tests & generate report run: poetry run coverage run -m pytest @@ -58,7 +52,5 @@ jobs: uses: actions/upload-artifact@v4 if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' with: - # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly name: python-coverage-comment-action - # If you use a different name, update COMMENT_FILENAME accordingly path: python-coverage-comment-action.txt diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 70e993b1..7a9e0606 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -9,17 +9,15 @@ on: jobs: coverage: runs-on: ubuntu-latest - + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' + permissions: + pull-requests: write + contents: write + actions: read steps: - - uses: actions/checkout@v3 - - - name: Download coverage report - uses: actions/download-artifact@v3 - with: - name: coverage-report - - name: Comment Coverage + - name: Post comment uses: py-cov-action/python-coverage-comment-action@v3 with: - test-command: poetry run pytest --cov=your_module --cov-report=xml - + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}