From 9776dd1a4db5dc7eda4a29d52467100443baae5b Mon Sep 17 00:00:00 2001 From: minherz Date: Sun, 24 Mar 2024 17:31:26 -0700 Subject: [PATCH] chore: update action.min.js just in case --- bin/action.min.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/bin/action.min.js b/bin/action.min.js index d8182dc4..0107a400 100644 --- a/bin/action.min.js +++ b/bin/action.min.js @@ -91666,22 +91666,20 @@ module.exports.setGracefulCleanup = setGracefulCleanup; * See the License for the specific language governing permissions and * limitations under the License. */ -// Set up Google Application Credentials for use by the Firebase CLI -// https://cloud.google.com/docs/authentication/production#finding_credentials_automatically -async function createGacFile(googleApplicationCredentials) { +// creates file with GAC info if parameter is not already a path to a file +// NOTE: no validation of the credential information is performed +async function createGacFile(gacInfo) { try { - if (fs.existsSync(googleApplicationCredentials)) { - return googleApplicationCredentials; + if (fs.existsSync(gacInfo)) { + return gacInfo; } } catch (e) { - console.log("debug: failed checking file existence with error %O", e); - // googleApplicationCredentials is not a path to a file + console.warn("unexpected error while validing GAC info. Interpreting provided info as credentials data."); } - const tmpFile = tmp.fileSync({ postfix: ".json" }); - fs.writeSync(tmpFile.fd, googleApplicationCredentials); + fs.writeSync(tmpFile.fd, gacInfo); return tmpFile.name; } @@ -93170,7 +93168,7 @@ const target = core.getInput("target"); const firebaseToolsVersion = core.getInput("firebaseToolsVersion"); async function run() { try { - core.startGroup("Verifying firebase.json exists"); + core.startGroup("Verifying setup parameters"); if (entryPoint !== ".") { console.log(`Changing to directory: ${entryPoint}`); try { @@ -93184,13 +93182,9 @@ async function run() { } else { console.warn("firebase.json file not found. If your firebase.json file is not in the root of your repo, edit the entryPoint option of this GitHub action."); } - core.endGroup(); - core.startGroup("Setting up CLI credentials"); - console.log("validating passed credentials: %s", googleApplicationCredentials); const gacFilename = await createGacFile(googleApplicationCredentials); - console.log("generated credentials: %s", gacFilename); if (gacFilename !== googleApplicationCredentials) { - console.log("Created a temporary file with Application Default Credentials."); + console.log("Created a temporary file with Google Application Credentials."); } core.endGroup(); if (configuredChannelId === "live") { @@ -93203,6 +93197,10 @@ async function run() { await deployToPreviewChannel(gacFilename, channelId); core.endGroup(); } + // cleanup + if (gacFilename !== googleApplicationCredentials) { + fs.unlinkSync(gacFilename); + } } catch (e) { core.setFailed(e.message); }