Skip to content

Commit

Permalink
so it's pull_request?
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Dec 16, 2023
1 parent 63fd646 commit c51779a
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -35,8 +29,8 @@ jobs:
new_score=$(cat docs/coverage/gef_py.html | grep pc_cov | sed 's?.*<span class="pc_cov">\([^%]*\)%</span>?\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
Expand All @@ -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 }}
Expand Down

0 comments on commit c51779a

Please sign in to comment.