Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debug option #325

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions bin/action.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -92981,10 +92981,12 @@ async function deployPreview(gacFilename, deployConfig) {
channelId,
target,
expires,
firebaseToolsVersion
firebaseToolsVersion,
debug
} = deployConfig;
const deploymentText = await execWithCredentials(["hosting:channel:deploy", channelId, ...(target ? ["--only", target] : []), ...(expires ? ["--expires", expires] : [])], projectId, gacFilename, {
firebaseToolsVersion
firebaseToolsVersion,
debug
});
const deploymentResult = JSON.parse(deploymentText.trim());
return deploymentResult;
Expand All @@ -92993,10 +92995,12 @@ async function deployProductionSite(gacFilename, productionDeployConfig) {
const {
projectId,
target,
firebaseToolsVersion
firebaseToolsVersion,
debug
} = productionDeployConfig;
const deploymentText = await execWithCredentials(["deploy", "--only", `hosting${target ? ":" + target : ""}`], projectId, gacFilename, {
firebaseToolsVersion
firebaseToolsVersion,
debug
});
const deploymentResult = JSON.parse(deploymentText);
return deploymentResult;
Expand Down Expand Up @@ -93179,6 +93183,7 @@ const octokit = token ? github.getOctokit(token) : undefined;
const entryPoint = core.getInput("entryPoint");
const target = core.getInput("target");
const firebaseToolsVersion = core.getInput("firebaseToolsVersion");
const debug$1 = core.getBooleanInput("debug");
async function run() {
const isPullRequest = !!github.context.payload.pull_request;
let finish = details => console.log(details);
Expand Down Expand Up @@ -93210,7 +93215,8 @@ async function run() {
const deployment = await deployProductionSite(gacFilename, {
projectId,
target,
firebaseToolsVersion
firebaseToolsVersion,
debug: debug$1
});
if (deployment.status === "error") {
throw Error(deployment.error);
Expand All @@ -93235,7 +93241,8 @@ async function run() {
expires,
channelId,
target,
firebaseToolsVersion
firebaseToolsVersion,
debug: debug$1
});
if (deployment.status === "error") {
throw Error(deployment.error);
Expand Down
16 changes: 9 additions & 7 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type DeployConfig = {
target?: string;
// Optional version specification for firebase-tools. Defaults to `latest`.
firebaseToolsVersion?: string;
debug?: boolean;
};

export type ChannelDeployConfig = DeployConfig & {
Expand All @@ -70,8 +71,8 @@ export function interpretChannelDeployResult(

async function execWithCredentials(
args: string[],
projectId,
gacFilename,
projectId: string,
gacFilename: string,
opts: { debug?: boolean; firebaseToolsVersion?: string }
) {
let deployOutputBuf: Buffer[] = [];
Expand Down Expand Up @@ -127,7 +128,7 @@ export async function deployPreview(
gacFilename: string,
deployConfig: ChannelDeployConfig
) {
const { projectId, channelId, target, expires, firebaseToolsVersion } =
const { projectId, channelId, target, expires, firebaseToolsVersion, debug } =
deployConfig;

const deploymentText = await execWithCredentials(
Expand All @@ -139,7 +140,7 @@ export async function deployPreview(
],
projectId,
gacFilename,
{ firebaseToolsVersion }
{ firebaseToolsVersion, debug }
);

const deploymentResult = JSON.parse(deploymentText.trim()) as
Expand All @@ -150,16 +151,17 @@ export async function deployPreview(
}

export async function deployProductionSite(
gacFilename,
gacFilename: string,
productionDeployConfig: ProductionDeployConfig
) {
const { projectId, target, firebaseToolsVersion } = productionDeployConfig;
const { projectId, target, firebaseToolsVersion, debug } =
productionDeployConfig;

const deploymentText = await execWithCredentials(
["deploy", "--only", `hosting${target ? ":" + target : ""}`],
projectId,
gacFilename,
{ firebaseToolsVersion }
{ firebaseToolsVersion, debug }
);

const deploymentResult = JSON.parse(deploymentText) as
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import {
endGroup,
getBooleanInput,
getInput,
setFailed,
setOutput,
Expand Down Expand Up @@ -50,6 +51,7 @@ const octokit = token ? getOctokit(token) : undefined;
const entryPoint = getInput("entryPoint");
const target = getInput("target");
const firebaseToolsVersion = getInput("firebaseToolsVersion");
const debug = getBooleanInput("debug");

async function run() {
const isPullRequest = !!context.payload.pull_request;
Expand Down Expand Up @@ -93,6 +95,7 @@ async function run() {
projectId,
target,
firebaseToolsVersion,
debug,
});
if (deployment.status === "error") {
throw Error((deployment as ErrorResult).error);
Expand Down Expand Up @@ -121,6 +124,7 @@ async function run() {
channelId,
target,
firebaseToolsVersion,
debug,
});

if (deployment.status === "error") {
Expand Down
Loading