Skip to content

Commit 45fa67d

Browse files
committed
rm mktplace check and move to Vercel
1 parent ce102ad commit 45fa67d

File tree

2 files changed

+25
-33
lines changed

2 files changed

+25
-33
lines changed
Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
11
name: PR Lighthouse Insights
22

33
on:
4-
pull_request:
5-
types: [opened, synchronize, reopened]
4+
repository_dispatch:
5+
types:
6+
- 'vercel.deployment.success'
67

78
jobs:
8-
wait-for-vercel:
9-
name: Wait for Vercel Preview
10-
runs-on: ubuntu-latest
11-
outputs:
12-
url: ${{ steps.get-preview.outputs.url }}
13-
steps:
14-
- name: Wait for Vercel preview URL to be available
15-
id: get-preview
16-
uses: patrickedqvist/wait-for-vercel-preview@v1
17-
with:
18-
token: ${{ secrets.GITHUB_TOKEN }}
19-
max_timeout: 600
20-
check_interval: 20
21-
environment: Preview
22-
23-
prLighthouseInsights:
24-
name: Run PR Lighthouse Insights
25-
needs: [wait-for-vercel]
9+
run-lighthouse:
10+
if: github.event.client_payload.environment == 'preview'
2611
uses: ./.github/workflows/template-lighthouse.yml
27-
permissions:
28-
pull-requests: write
2912
with:
30-
url: ${{ needs.wait-for-vercel.outputs.url }}
13+
url: ${{ github.event.client_payload.url }}
3114
secrets:
3215
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}

.github/workflows/template-lighthouse.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,23 @@ jobs:
1919
name: Run Lighthouse Insights
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v5
22+
- name: Checkout (PR)
23+
if: github.event_name == 'pull_request'
24+
uses: actions/checkout@v5
2325
with:
2426
token: ${{ secrets.GITHUB_TOKEN }}
2527
ref: ${{ github.event.pull_request.head.ref }}
2628
repository: ${{ github.event.pull_request.head.repo.full_name }}
2729

30+
# repository_dispatch context from Vercel
31+
- name: Checkout (repository_dispatch)
32+
if: github.event_name == 'repository_dispatch'
33+
uses: actions/checkout@v5
34+
with:
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
ref: ${{ github.event.client_payload.git.sha }}
37+
repository: ${{ github.repository }}
38+
2839
- uses: actions/setup-node@v6
2940
with:
3041
node-version-file: ".nvmrc"
@@ -42,20 +53,18 @@ jobs:
4253
configPath: ./.lighthouserc.json
4354
urls: |
4455
${{ inputs.url }}
45-
56+
4657
- name: Create lighthouse report
4758
id: lighthouse-results-generate
4859
env:
4960
GITHUB_EVENT_NAME: ${{ github.event_name }}
50-
run: |
51-
python scripts/generate-lighthouse-report.py
61+
run: python scripts/generate-lighthouse-report.py
5262

5363
- name: Comment on PR with Lighthouse insights
54-
uses: mshick/add-pr-comment@v2
5564
if: github.event_name == 'pull_request'
65+
uses: mshick/add-pr-comment@v2
5666
with:
57-
message: |
58-
${{ steps.lighthouse-results-generate.outputs.report }}
67+
message: ${{ steps.lighthouse-results-generate.outputs.report }}
5968
repo-token: ${{ secrets.GITHUB_TOKEN }}
6069
allow-repeats: true
6170

@@ -66,8 +75,8 @@ jobs:
6675
"$report_content" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
6776

6877
- name: Create token for GitHub App
69-
uses: actions/create-github-app-token@v2
7078
if: github.event_name != 'pull_request'
79+
uses: actions/create-github-app-token@v2
7180
id: get-app-token
7281
with:
7382
app-id: ${{ vars.GH_APP_ID }}
@@ -82,5 +91,5 @@ jobs:
8291
uses: dsanders11/github-app-commit-action@v1
8392
with:
8493
message: "Updated Lighthouse markdown report generated by workflow run: ${{ github.run_number }} [skip ci]"
85-
force: true # to make sure the update is a fast-forward update
86-
token: ${{ steps.get-app-token.outputs.token }}
94+
force: true
95+
token: ${{ steps.get-app-token.outputs.token }}

0 commit comments

Comments
 (0)