Skip to content

Commit

Permalink
add test coverage to PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlamallama committed Oct 17, 2024
1 parent 912ad81 commit 7f0660e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ jobs:
git fetch origin develop
git diff origin/develop --unified=0 > diff.txt
grep '^@@' diff.txt | awk '{print $2}' > changed_lines.txt
- name: Extract untested new lines
id: untested_new_code
run: |
COVERAGE_FILE=coverage.txt
DIFF_FILE=changed_lines.txt
UNTTESTED_LINES=""
# Loop through the changed lines to find untested lines
while IFS= read -r LINE; do
LINE_NUM=$(echo "$LINE" | grep -oP '\d+')
UNTTESTED_LINE=$(grep -E "^ *$LINE_NUM " $COVERAGE_FILE | grep 'missed')
if [ -n "$UNTTESTED_LINE" ]; then
UNTTESTED_LINES="$UNTTESTED_LINES\n$UNTTESTED_LINE"
fi
done < $DIFF_FILE
echo "UNTTESTED_LINES=$UNTTESTED_LINES" >> $GITHUB_ENV
- name: Post coverage comment on PR
uses: actions/github-script@v6
with:
Expand Down

0 comments on commit 7f0660e

Please sign in to comment.