mirror of
https://github.com/bartvdbraak/omnidash.git
synced 2025-04-27 23:41:21 +00:00
refactor: use better loading and titles
This commit is contained in:
parent
c0ca551679
commit
321e00ed26
1 changed files with 21 additions and 15 deletions
36
.github/workflows/unlighthouse.yaml
vendored
36
.github/workflows/unlighthouse.yaml
vendored
|
@ -15,6 +15,9 @@ jobs:
|
||||||
COMMENT_ID: unlighthouse-node${{matrix.node-version}}
|
COMMENT_ID: unlighthouse-node${{matrix.node-version}}
|
||||||
PORT: 8000
|
PORT: 8000
|
||||||
CLOUDFLARE_PROJECT: omnidash-unlighthouse
|
CLOUDFLARE_PROJECT: omnidash-unlighthouse
|
||||||
|
WEBSITE_URL: https://omnidash.io
|
||||||
|
BADGE_FILE: omnidash.io-unlighthouse.json
|
||||||
|
BADGE_GIST: b948b29508e19955106a1037d2a615e6
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [20]
|
node-version: [20]
|
||||||
|
@ -25,18 +28,19 @@ jobs:
|
||||||
with:
|
with:
|
||||||
header: ${{ env.COMMENT_ID }}
|
header: ${{ env.COMMENT_ID }}
|
||||||
message: |
|
message: |
|
||||||
⚡️ Lighthouse report
|
## 🔄 **Unlighthouse report in progress** 🗼
|
||||||
|
|
||||||

|
<div align="center"></br></br><img src="https://github.com/bartvdbraak/omnidash/assets/3996360/f994f62a-6a85-450b-bb4d-927a56542e33"></div>
|
||||||
|
|
||||||
- name: Set variables based on trigger
|
- name: Set variables based on trigger
|
||||||
|
id: set_variables
|
||||||
run: |
|
run: |
|
||||||
if [[ ${{ github.ref == 'refs/heads/main' }} == true ]]; then
|
if [[ ${{ github.ref == 'refs/heads/main' }} == true ]]; then
|
||||||
echo "CLOUDFLARE_BRANCH=main" >> $GITHUB_ENV
|
echo "CLOUDFLARE_BRANCH=main" >> $GITHUB_OUTPUT
|
||||||
echo "CLOUDFLARE_URL=https://${{ env.CLOUDFLARE_PROJECT }}.pages.dev" >> $GITHUB_ENV
|
echo "CLOUDFLARE_URL=https://${{ env.CLOUDFLARE_PROJECT }}.pages.dev" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "CLOUDFLARE_BRANCH=pull-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
|
echo "CLOUDFLARE_BRANCH=pull-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
|
||||||
echo "CLOUDFLARE_URL=https://pull-${{ github.event.pull_request.number }}.${{ env.CLOUDFLARE_PROJECT }}.pages.dev" >> $GITHUB_ENV
|
echo "CLOUDFLARE_URL=https://pull-${{ github.event.pull_request.number }}.${{ env.CLOUDFLARE_PROJECT }}.pages.dev" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
@ -75,7 +79,7 @@ jobs:
|
||||||
- name: Run Unlighthouse
|
- name: Run Unlighthouse
|
||||||
run: |
|
run: |
|
||||||
unlighthouse-ci \
|
unlighthouse-ci \
|
||||||
--site "${{ github.ref == 'refs/heads/main' && 'https://omnidash.io' || steps.vercel_preview_url.outputs.preview_url }}" \
|
--site "${{ github.ref == 'refs/heads/main' && env.WEBSITE_URL || steps.vercel_preview_url.outputs.preview_url }}" \
|
||||||
--reporter jsonExpanded \
|
--reporter jsonExpanded \
|
||||||
--build-static
|
--build-static
|
||||||
|
|
||||||
|
@ -83,7 +87,7 @@ jobs:
|
||||||
uses: cloudflare/wrangler-action@v3.4.1
|
uses: cloudflare/wrangler-action@v3.4.1
|
||||||
with:
|
with:
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
command: pages deploy .unlighthouse --project-name="${{ env.CLOUDFLARE_PROJECT }}" --branch=${{ env.CLOUDFLARE_BRANCH }}
|
command: pages deploy .unlighthouse --project-name="${{ env.CLOUDFLARE_PROJECT }}" --branch=${{ steps.set_variables.outputs.CLOUDFLARE_BRANCH }}
|
||||||
|
|
||||||
- name: Create result content
|
- name: Create result content
|
||||||
id: create_result_content
|
id: create_result_content
|
||||||
|
@ -101,10 +105,10 @@ jobs:
|
||||||
|
|
||||||
const score = res => `${getEmoji(res)} ${formatScore(res)}`;
|
const score = res => `${getEmoji(res)} ${formatScore(res)}`;
|
||||||
|
|
||||||
const reportUrl = `${{ env.CLOUDFLARE_URL }}`;
|
const reportUrl = `${{ steps.set_variables.outputs.CLOUDFLARE_URL }}`;
|
||||||
|
|
||||||
const comment = [
|
const comment = [
|
||||||
`⚡️ Lighthouse report for the changes in this PR:`,
|
`## ✅ **Unlighthouse report** 🗼`,
|
||||||
'| Category | Score |',
|
'| Category | Score |',
|
||||||
'| --- | --- |',
|
'| --- | --- |',
|
||||||
`| Performance | ${score(result.summary.categories.performance.averageScore)} |`,
|
`| Performance | ${score(result.summary.categories.performance.averageScore)} |`,
|
||||||
|
@ -144,8 +148,8 @@ jobs:
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
with:
|
with:
|
||||||
auth: ${{ secrets.GIST_SECRET }}
|
auth: ${{ secrets.GIST_SECRET }}
|
||||||
gistID: 795a3d6af5b0db5754cf7279898c3c16
|
gistID: ${{ env.BADGE_GIST }}
|
||||||
filename: omnidash.io-unlighthouse.json
|
filename: ${{ env.BADGE_FILE }}
|
||||||
namedLogo: Lighthouse
|
namedLogo: Lighthouse
|
||||||
label: lighthouse
|
label: lighthouse
|
||||||
message: ${{ steps.create_result_content.outputs.score }}
|
message: ${{ steps.create_result_content.outputs.score }}
|
||||||
|
@ -157,9 +161,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
header: ${{ env.COMMENT_ID }}
|
header: ${{ env.COMMENT_ID }}
|
||||||
message: |
|
message: |
|
||||||
⚡️ Lighthouse report failed
|
## ❌ **Unlighthouse report failed** 🗼
|
||||||
|
|
||||||
See deployment for any errors
|
<div align="center"></br></br><img src="https://github.com/bartvdbraak/omnidash/assets/3996360/cc1c6fb9-f9be-4a69-9666-655d6733abeb"></div>
|
||||||
|
|
||||||
- name: Update comment on cancel
|
- name: Update comment on cancel
|
||||||
uses: marocchino/sticky-pull-request-comment@v2.9.0
|
uses: marocchino/sticky-pull-request-comment@v2.9.0
|
||||||
|
@ -167,4 +171,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
header: ${{ env.COMMENT_ID }}
|
header: ${{ env.COMMENT_ID }}
|
||||||
message: |
|
message: |
|
||||||
⚡️ Lighthouse report cancelled
|
## 🛑 **Unlighthouse report was cancelled** 🗼
|
||||||
|
|
||||||
|
<div align="center"></br></br><img src="https://github.com/bartvdbraak/omnidash/assets/3996360/cc1c6fb9-f9be-4a69-9666-655d6733abeb"></div>
|
||||||
|
|
Loading…
Reference in a new issue