File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 38
38
ref : ${{ github.event.workflow_run.head_branch }}
39
39
- uses : actions/setup-node@v5
40
40
with :
41
- node-version : 18
41
+ node-version : 22
42
42
- name : Installing packages
43
43
run : cd performance && npm ci
44
44
- name : Generating lighthouse reports for PR...
@@ -58,14 +58,21 @@ jobs:
58
58
continue-on-error : true
59
59
run : |
60
60
FIELDS=("performance" "accessibility")
61
+ TOLERANCE=0.05
62
+ FLOOR_VALUE=90
61
63
for FIELD in "${FIELDS[@]}"; do
62
64
PR_VALUE=$(cat lighthouse-reports/pr-report.json | jq -r ".categories.$FIELD.score")
63
65
MAIN_VALUE=$(cat lighthouse-reports/main-report.json | jq -r ".categories.$FIELD.score")
64
66
echo "$FIELD: PR - $PR_VALUE | Main - $MAIN_VALUE"
65
67
68
+ if (( $(echo "$PR_VALUE < $FLOOR_VALUE" | bc -l) )); then
69
+ echo "Error: $FIELD score in PR ($PR_VALUE) is less than accepted value ($FLOOR_VALUE)"
70
+ exit 1
71
+ fi
72
+
66
73
if [ $FIELD = "performance" ]; then
67
- LOWER_BOUND=$(echo "$MAIN_VALUE - 0.05 " | bc)
68
- UPPER_BOUND=$(echo "$MAIN_VALUE + 0.05 " | bc)
74
+ LOWER_BOUND=$(echo "$MAIN_VALUE - $TOLERANCE " | bc)
75
+ UPPER_BOUND=$(echo "$MAIN_VALUE + $TOLERANCE " | bc)
69
76
if (( $(echo "$PR_VALUE < $LOWER_BOUND" | bc -l) || $(echo "$PR_VALUE > $UPPER_BOUND" | bc -l) )); then
70
77
echo "Error: $FIELD score in PR ($PR_VALUE) is less than in MAIN ($MAIN_VALUE)"
71
78
exit 1
You can’t perform that action at this time.
0 commit comments