You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replaces the multi-line Python script for extracting coverage percentage from coverage.xml with a single-line command, improving readability and maintainability in the test-status GitHub Actions workflow.
Copy file name to clipboardExpand all lines: .github/workflows/test-status.yml
+1-10Lines changed: 1 addition & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -50,16 +50,7 @@ jobs:
50
50
51
51
if [ -f coverage.xml ]; then
52
52
# Extract coverage percentage
53
-
COVERAGE=$(python3 -c "
54
-
import xml.etree.ElementTree as ET
55
-
try:
56
-
tree = ET.parse('coverage.xml')
57
-
root = tree.getroot()
58
-
coverage = float(root.attrib['line-rate']) * 100
59
-
print(f'{coverage:.0f}')
60
-
except:
61
-
print('0')
62
-
")
53
+
COVERAGE=$(python3 -c "import xml.etree.ElementTree as ET; tree = ET.parse('coverage.xml') if __import__('os').path.exists('coverage.xml') else None; print(int(float(tree.getroot().attrib['line-rate']) * 100) if tree else 0)")
0 commit comments