File tree Expand file tree Collapse file tree 4 files changed +34
-5
lines changed
Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 11name : ' WebPageTest GitHub Action'
2- description : ' Automatically run WebPageTest against URLs'
2+ author : ' WebPageTest'
3+ description : ' Automatically test code changes in WebPageTest and enforce performance budgets'
34inputs :
45 apiKey :
56 description : ' WebPageTest API Token'
67 required : true
78 urls :
89 description : ' List of URL(s) to test'
10+ required : true
911 budget :
10- description : ' WebPageTest Test Specs JSON file'
12+ description : ' Path to WebPageTest testspecs.json file'
13+ required : false
1114 label :
1215 description : ' Label for test (shows up in WebPageTest)'
16+ required : false
17+ wptOptions :
18+ description : ' Path to JSON file with WebPageTest test options (see https://github.com/marcelduran/webpagetest-api#test-works-for-runtest-method-only)'
19+ required : false
1320 GITHUB_TOKEN :
1421 description : ' Secret GitHub Token (automatically provided by GitHub)'
1522runs :
1623 using : ' node12'
17- main : ' index.js'
24+ main : ' index.js'
25+ branding :
26+ icon : ' bar-chart-2'
27+ color : ' blue'
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ const WebPageTest = require("webpagetest");
22const core = require ( "@actions/core" ) ;
33const github = require ( '@actions/github' ) ;
44const ejs = require ( 'ejs' ) ;
5+ const { cornflowerblue } = require ( "color-name" ) ;
56
67const WPT_BUDGET = core . getInput ( 'budget' ) ;
8+ const WPT_OPTIONS = core . getInput ( 'wptOptions' ) ;
79const WPT_API_KEY = core . getInput ( 'apiKey' ) ;
810const WPT_URLS = core . getInput ( 'urls' ) . split ( "\n" ) ;
911const WPT_LABEL = core . getInput ( 'label' ) ;
@@ -69,12 +71,25 @@ async function run() {
6971 //TODO: make this configurable
7072 let options = {
7173 "firstViewOnly" : true ,
72- "runs" : 1 ,
73- "location" : 'Dulles:Chrome ' ,
74+ "runs" : 3 ,
75+ "location" : 'Dulles_MotoG4 ' ,
7476 "connectivity" : '4G' ,
7577 "pollResults" : 5 ,
7678 "timeout" : 240
7779 }
80+ if ( WPT_OPTIONS ) {
81+ let settings = require ( WPT_OPTIONS ) ;
82+ if ( typeof settings === 'object' && settings !== null ) {
83+ core . debug ( settings ) ;
84+ options = {
85+ ...options ,
86+ ...settings
87+ }
88+ } else {
89+ core . setFailed ( "The specified WebPageTest settings aren't a valid JavaScript object" ) ;
90+ }
91+
92+ }
7893 if ( WPT_BUDGET ) {
7994 options . specs = require ( WPT_BUDGET ) ;
8095 }
File renamed without changes.
Original file line number Diff line number Diff line change 1+ {
2+ "runs" : 1 ,
3+ "location" : " Dulles:Chrome"
4+ }
You can’t perform that action at this time.
0 commit comments