@@ -29,12 +29,12 @@ jobs:
29
29
run : |
30
30
PREVIEW_URL="https://deploy-preview-${{ github.event.pull_request.number }}--expressjscom-preview.netlify.app"
31
31
echo "PREVIEW_URL=$PREVIEW_URL" >> "$GITHUB_ENV"
32
- for i in {1..2 }; do
32
+ for i in {1..4 }; do
33
33
if curl -s --head "$PREVIEW_URL" | grep "200 OK" > /dev/null; then
34
34
echo "Preview is live!"
35
35
break
36
36
fi
37
- echo "Waiting for Netlify to deploy... ($i/2 )"
37
+ echo "Waiting for Netlify to deploy... ($i/4 )"
38
38
sleep 10
39
39
done
40
40
60
60
61
61
npx lighthouse "$url" \
62
62
$lighthouse_args \
63
+ --only-categories=performance,accessibility,best-practices \
63
64
--output json \
64
65
--output-path="lighthouse-report-${device}.json" \
65
66
--chrome-flags="--headless"
@@ -104,31 +105,32 @@ jobs:
104
105
script : |
105
106
const fs = require('fs');
106
107
const report = fs.readFileSync('lighthouse-report.md', 'utf8');
107
-
108
+
108
109
const { data: comments } = await github.rest.issues.listComments({
109
110
issue_number: context.payload.pull_request.number,
110
111
owner: context.repo.owner,
111
112
repo: context.repo.repo,
112
113
});
113
-
114
+
114
115
const botComment = comments.find(comment =>
115
- comment.user.type === ' Bot' &&
116
- comment.body.includes('🚦 Lighthouse Results' )
116
+ comment.user.type === " Bot" &&
117
+ comment.body.includes("🚦 Lighthouse Results" )
117
118
);
118
-
119
+
119
120
if (botComment) {
120
121
await github.rest.issues.updateComment({
121
122
comment_id: botComment.id,
122
123
owner: context.repo.owner,
123
124
repo: context.repo.repo,
124
- body : report
125
+ body: report,
125
126
});
127
+ console.log("Updated existing Lighthouse comment.");
126
128
} else {
127
129
await github.rest.issues.createComment({
128
130
issue_number: context.payload.pull_request.number,
129
131
owner: context.repo.owner,
130
132
repo: context.repo.repo,
131
- body : report
133
+ body: report,
132
134
});
135
+ console.log("Created new Lighthouse comment.");
133
136
}
134
-
0 commit comments