File tree Expand file tree Collapse file tree 4 files changed +87
-3
lines changed Expand file tree Collapse file tree 4 files changed +87
-3
lines changed Original file line number Diff line number Diff line change 1616 lhci :
1717 name : Lighthouse Report - ${{ inputs.environment != null && inputs.environment || 'prod' }}
1818 runs-on : ubuntu-latest
19+ permissions :
20+ contents : read
21+ id-token : write
1922 steps :
2023 - uses : actions/checkout@v4
2124 - name : Use Node.js 20.9.x
3235 run : |
3336 npm ci
3437 npm run build-cronjobs
38+ - name : Authenticate to Google Cloud
39+ uses : google-github-actions/auth@v2
40+ with :
41+ workload_identity_provider : ${{ secrets.GC_LIGHTHOUSE_WORKLOAD_IDENTITY_PROVIDER }}
42+ service_account : ${{ secrets.GC_LIGHTHOUSE_SERVICE_ACCOUNT }}
43+ env :
44+ BQ_LIGHTHOUSE_DATASET : ${{ secrets.BQ_LIGHTHOUSE_DATASET }}
3545 - name : Report results
3646 run : npm run cron:report-lighthouse-results
Original file line number Diff line number Diff line change 115115 },
116116 "devDependencies" : {
117117 "@faker-js/faker" : " ^9.3.0" ,
118+ "@google-cloud/bigquery" : " ^7.9.1" ,
118119 "@playwright/test" : " ^1.49.1" ,
119120 "@storybook/addon-a11y" : " ^8.4.7" ,
120121 "@storybook/addon-actions" : " ^8.4.7" ,
Original file line number Diff line number Diff line change 33 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44
55import { readFile } from "node:fs/promises" ;
6+ import { BigQuery } from "@google-cloud/bigquery" ;
67import { logger } from "../../app/functions/server/logging" ;
78
89const AUDITS_TO_INCLUDE = [
@@ -29,6 +30,17 @@ type LighthouseResult = {
2930 } ;
3031} ;
3132
33+ async function getLighthouseResults ( ) {
34+ try {
35+ const bigQueryClient = new BigQuery ( ) ;
36+ const query = `SELECT * FROM ${ process . env . BQ_LIGHTHOUSE_DATASET } ` ;
37+ const [ rows ] = await bigQueryClient . query ( { query } ) ;
38+ return rows ;
39+ } catch ( error ) {
40+ console . error ( "Error querying Lighthouse results" , error ) ;
41+ }
42+ }
43+
3244async function run ( ) {
3345 // The Lighthouse report that will be created by running LHCI.
3446 const lighthouseResults : LighthouseResult [ ] =
@@ -72,6 +84,9 @@ async function run() {
7284 } ) ;
7385 console . table ( transformedData ) ;
7486 logger . info ( "lighthouse_report" , lighthouseReport ) ;
87+
88+ const results = getLighthouseResults ( ) ;
89+ console . info ( "BigQuery dataset" , results ) ;
7590}
7691
7792try {
You can’t perform that action at this time.
0 commit comments