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 3838 ref : ${{ github.event.workflow_run.head_branch }}
3939 - uses : actions/setup-node@v5
4040 with :
41- node-version : 18
41+ node-version : 22
4242 - name : Installing packages
4343 run : cd performance && npm ci
4444 - name : Generating lighthouse reports for PR...
@@ -58,14 +58,21 @@ jobs:
5858 continue-on-error : true
5959 run : |
6060 FIELDS=("performance" "accessibility")
61+ TOLERANCE=0.05
62+ FLOOR_VALUE=90
6163 for FIELD in "${FIELDS[@]}"; do
6264 PR_VALUE=$(cat lighthouse-reports/pr-report.json | jq -r ".categories.$FIELD.score")
6365 MAIN_VALUE=$(cat lighthouse-reports/main-report.json | jq -r ".categories.$FIELD.score")
6466 echo "$FIELD: PR - $PR_VALUE | Main - $MAIN_VALUE"
6567
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+
6673 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)
6976 if (( $(echo "$PR_VALUE < $LOWER_BOUND" | bc -l) || $(echo "$PR_VALUE > $UPPER_BOUND" | bc -l) )); then
7077 echo "Error: $FIELD score in PR ($PR_VALUE) is less than in MAIN ($MAIN_VALUE)"
7178 exit 1
You can’t perform that action at this time.
0 commit comments