From c51779af2ed193ac06cf0601bd69780185a28554 Mon Sep 17 00:00:00 2001 From: hugsy Date: Fri, 15 Dec 2023 17:29:18 -0800 Subject: [PATCH] so it's pull_request? --- .github/workflows/coverage.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 5df5b3771..b642dd769 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,22 +1,16 @@ name: CI Coverage for PR on: - # pull_request: - pull_request_target: + pull_request: jobs: coverage: env: PY_VER: 3.10 runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - + - name: Checkout + uses: actions/checkout@v4 - name: Run test coverage id: get_coverage env: @@ -35,8 +29,8 @@ jobs: new_score=$(cat docs/coverage/gef_py.html | grep pc_cov | sed 's?.*\([^%]*\)%?\1?g') diff_score=$(python -c "print(${new_score} - ${current_score})") commit=${{ github.event.pull_request.head.sha }} - include_tests=$(git diff ${{ github.event.pull_request.head.sha }}~1 ${{ github.event.pull_request.head.sha }} --compact-summary | egrep --count '^ tests/' || true) - include_docs=$(git diff ${{ github.event.pull_request.head.sha }}~1 ${{ github.event.pull_request.head.sha }} --compact-summary | egrep --count '^ docs/' || true) + include_tests=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} --compact-summary | egrep --count '^ tests/' || true) + include_docs=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} --compact-summary | egrep --count '^ docs/' || true) echo "commit=${commit}" >> $GITHUB_OUTPUT echo "new_coverage_score=${new_score}" >> $GITHUB_OUTPUT echo "current_coverage_score=${current_score}" >> $GITHUB_OUTPUT @@ -52,7 +46,7 @@ jobs: done echo "words_found=${WORDS_FOUND}" >> $GITHUB_OUTPUT - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 env: COMMIT: ${{ steps.get_coverage.outputs.commit }} SCORE_OLD: ${{ steps.get_coverage.outputs.current_coverage_score }}