Skip to content

Commit

Permalink
add faile dmetrics
Browse files Browse the repository at this point in the history
Signed-off-by: Ruchi Sharma <ruchi492@gmail.com>
  • Loading branch information
ruchidh committed Feb 4, 2025
1 parent 3142bd4 commit 5f3b91a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ jobs:
with:
github_token: ${{ steps.github_app_token.outputs.token }}
head_template: backport/backport-<%= number %>-to-<%= base %>
files_to_skip: "CHANGELOG.md"
files_to_skip: 'CHANGELOG.md'
labels_template: "<%= JSON.stringify([...labels, 'autocut']) %>"
failure_labels: "failed backport"
failure_labels: 'failed backport'
30 changes: 27 additions & 3 deletions .github/workflows/performance_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,33 @@ jobs:
run: |
echo "🚦 **Lighthouse CI Report**" > comment.txt
echo "" >> comment.txt
# Run Lighthouse and capture failures
yarn lhci autorun --json > lhci_output.json || true
# Extract failed assertions
FAILURES=$(jq -r '[.assertionResults[] | select(.status=="fail") |
{metric: .auditId, reason: .explanation}]' lhci_output.json)
if [[ "$FAILURES" == "[]" ]]; then
echo "✅ All Lighthouse metrics passed!" >> comment.txt
else
echo "❌ **Failed Lighthouse Metrics:**" >> comment.txt
echo '```json' >> comment.txt
echo "$FAILURES" >> comment.txt
echo '```' >> comment.txt
fi
# Ensure correct extraction of the report URL
yarn lhci upload --target=temporary-public-storage | tee lhci_output.txt
REPORT_URL=$(grep -o 'https://storage.googleapis.com/lighthouse-infrastructure-.*' lhci_output.txt | head -n 1)
echo "🔗 [View Full Lighthouse Report]($REPORT_URL)" >> comment.txt
REPORT_URL=$(grep -Eo 'https://storage.googleapis.com/lighthouse-infrastructure-[^\s]+' lhci_output.txt | head -n 1)
if [[ -n "$REPORT_URL" ]]; then
echo "🔗 [View Full Lighthouse Report]($REPORT_URL)" >> comment.txt
else
echo "⚠️ Lighthouse report link not found. Check workflow logs." >> comment.txt
fi
gh pr comment ${{ github.event.pull_request.number }} --body "$(cat comment.txt)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

0 comments on commit 5f3b91a

Please sign in to comment.