mirror of
https://github.com/lukaszraczylo/shared-actions.git
synced 2026-10-12 04:54:48 +00:00
fix(go-pr): read only the total line of the coverage report
The coverage step matched every line that contains the word total, so a function name such as subtotal added a second value. GitHub then rejected the multi-line step output. The step now reads the line that starts with total:.
This commit is contained in:
@@ -337,7 +337,7 @@ jobs:
|
|||||||
- name: Calculate coverage
|
- name: Calculate coverage
|
||||||
id: coverage
|
id: coverage
|
||||||
run: |
|
run: |
|
||||||
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
COVERAGE=$(go tool cover -func=coverage.out | awk '/^total:/ {print $3}' | sed 's/%//')
|
||||||
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
|
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
|
||||||
echo "Total Coverage: $COVERAGE%"
|
echo "Total Coverage: $COVERAGE%"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user