From e4e4dc8368c00d8a48a343363aa7b4ea54df3d35 Mon Sep 17 00:00:00 2001 From: Julien Tanay Date: Thu, 25 Aug 2022 12:35:16 +0200 Subject: [PATCH] Add uploadExtraArgs support --- README.md | 8 ++++++++ action.yml | 2 ++ src/config.js | 1 + src/index.js | 2 ++ 4 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 815d2fbe4..a2136b91d 100644 --- a/README.md +++ b/README.md @@ -517,6 +517,14 @@ Upload Lighthouse results as [action artifacts](https://help.github.com/en/actio uploadArtifacts: true ``` +#### `uploadExtraArgs` + +Add extra args to the [upload command](https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md#upload). + +```yml +uploadExtraArgs: "--extraHeaders.Authorization='Bearer X92sEo3n1J1F0k1E9' --extraHeaders.Foo='Bar'" +``` + #### `temporaryPublicStorage` (default: false) Upload reports to the [_temporary public storage_](https://github.com/GoogleChrome/lighthouse-ci/blob/master/docs/getting-started.md#collect-lighthouse-results). diff --git a/action.yml b/action.yml index d61e05992..536f60ac1 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,8 @@ inputs: description: 'Basic auth username for LHCI server' basicAuthPassword: description: 'Basic auth password for LHCI server' + uploadExtraArgs: + description: 'Upload command extra arguments' outputs: resultsPath: description: 'Path to the folder with LHCI results' diff --git a/src/config.js b/src/config.js index 66779540c..5b87fc7bd 100644 --- a/src/config.js +++ b/src/config.js @@ -74,6 +74,7 @@ exports.getInput = function getInputArgs() { serverToken, temporaryPublicStorage, uploadArtifacts: core.getInput('uploadArtifacts') === 'true' ? true : false, + uploadExtraArgs: core.getInput('uploadExtraArgs') || '', basicAuthUsername: core.getInput('basicAuthUsername') || 'lighthouse', basicAuthPassword: core.getInput('basicAuthPassword'), artifactName: core.getInput('artifactName'), diff --git a/src/index.js b/src/index.js index df24771a5..90a9c7301 100644 --- a/src/index.js +++ b/src/index.js @@ -91,6 +91,8 @@ async function main() { if (input.configPath) uploadParams.push(`--config=${input.configPath}`) + if (input.uploadExtraArgs) uploadParams.push(input.uploadExtraArgs) + const uploadStatus = runChildCommand('upload', uploadParams) if (uploadStatus !== 0) throw new Error(`LHCI 'upload' failed to upload to LHCI server.`) }