-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/interactions-ratelimit
- Loading branch information
Showing
211 changed files
with
6,393 additions
and
6,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ name: 'Issue Labeler' | |
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
issue-triage: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: 'Lighthouse Audit (main)' | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
lighthouse_audit_main: | ||
name: 'Lighthouse Audit (main)' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Audit production URLs with Lighthouse | ||
id: lighthouse_audit | ||
uses: treosh/lighthouse-ci-action@v9 | ||
with: | ||
urls: | | ||
https://discordjs.dev | ||
https://guide.discordjs.dev | ||
uploadArtifacts: true | ||
temporaryPublicStorage: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: 'Lighthouse Audit' | ||
on: | ||
issue_comment: | ||
types: [created, edited] | ||
jobs: | ||
lighthouse_audit: | ||
name: 'Lighthouse Audit' | ||
if: ${{ github.event.issue.pull_request }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get Vercel preview URL | ||
id: get_preview_url | ||
uses: actions/github-script@v3 | ||
with: | ||
script: | | ||
const comment = context.payload.comment; | ||
const regex = /https:\/\/[a-z0-9-]+\.vercel\.app/g; | ||
const matches = comment.body.match(regex); | ||
let previewUrl = ""; | ||
if (matches && matches.length) { | ||
previewUrl = matches[0]; | ||
console.log('Preview url found:', previewUrl); | ||
} | ||
console.log("No preview url found."); | ||
core.setOutput('vercel_preview_url', previewUrl); | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Add comment to PR | ||
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }} | ||
id: loading_comment_to_pr | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
number: ${{ github.event.issue.number }} | ||
header: lighthouse | ||
message: | | ||
Running Lighthouse audit... | ||
- name: Checkout repository | ||
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Audit preview URL with Lighthouse | ||
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }} | ||
id: lighthouse_audit | ||
uses: treosh/lighthouse-ci-action@v9 | ||
with: | ||
urls: | | ||
${{ steps.get_preview_url.outputs.vercel_preview_url }} | ||
uploadArtifacts: true | ||
temporaryPublicStorage: true | ||
|
||
- name: Format lighthouse score | ||
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }} | ||
id: format_lighthouse_score | ||
uses: actions/github-script@v3 | ||
with: | ||
script: | | ||
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary | ||
const links = ${{ steps.lighthouse_audit.outputs.links }} | ||
const formatResult = (res) => Math.round((res * 100)) | ||
Object.keys(result).forEach(key => result[key] = formatResult(result[key])) | ||
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴' | ||
const comment = [ | ||
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`, | ||
'| Category | Score |', | ||
'| --- | --- |', | ||
`| ${score(result.performance)} Performance | ${result.performance} |`, | ||
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`, | ||
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`, | ||
`| ${score(result.seo)} SEO | ${result.seo} |`, | ||
`| ${score(result.pwa)} PWA | ${result.pwa} |`, | ||
' ', | ||
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*` | ||
].join('\n') | ||
core.setOutput("comment", comment); | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Add comment to PR | ||
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }} | ||
id: comment_to_pr | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
number: ${{ github.event.issue.number }} | ||
header: lighthouse | ||
message: | | ||
${{ steps.format_lighthouse_score.outputs.comment }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,4 @@ out/ | |
# Cache | ||
.prettiercache | ||
.eslintcache | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.