Skip to content

chore: adding trailingComma prettier #401

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

Open
wants to merge 1 commit 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
1 change: 1 addition & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
# limitations under the License.

singleQuote: false
trailingComma: none
4 changes: 2 additions & 2 deletions babel.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
module.exports = {
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
"@babel/preset-typescript",
],
"@babel/preset-typescript"
]
};
1 change: 0 additions & 1 deletion bin/action.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -92976,7 +92976,6 @@ async function execWithCredentials(args, projectId, gacFilename, opts) {
}
return deployOutputBuf.length ? deployOutputBuf[deployOutputBuf.length - 1].toString("utf-8") : ""; // output from the CLI
}

async function deployPreview(gacFilename, deployConfig) {
const {
projectId,
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default {
preset: "ts-jest",

// The test environment that will be used for testing
testEnvironment: "node",
testEnvironment: "node"
};
4 changes: 2 additions & 2 deletions src/createCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function createCheck(
...context.repo,
name: "Deploy Preview",
head_sha: context.payload.pull_request?.head.sha,
status: "in_progress",
status: "in_progress"
});

return async (details: Object) => {
Expand All @@ -34,7 +34,7 @@ export async function createCheck(
check_run_id: check.data.id,
completed_at: new Date().toISOString(),
status: "completed",
...details,
...details
});
};
}
14 changes: 7 additions & 7 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function interpretChannelDeployResult(
return {
expireTime,
expire_time_formatted,
urls,
urls
};
}

Expand All @@ -88,19 +88,19 @@ async function execWithCredentials(
...(projectId ? ["--project", projectId] : []),
debug
? "--debug" // gives a more thorough error message
: "--json", // allows us to easily parse the output
: "--json" // allows us to easily parse the output
],
{
listeners: {
stdout(data: Buffer) {
deployOutputBuf.push(data);
},
}
},
env: {
...process.env,
FIREBASE_DEPLOY_AGENT: "action-hosting-deploy",
GOOGLE_APPLICATION_CREDENTIALS: gacFilename, // the CLI will automatically authenticate with this env variable set
},
GOOGLE_APPLICATION_CREDENTIALS: gacFilename // the CLI will automatically authenticate with this env variable set
}
}
);
} catch (e) {
Expand All @@ -113,7 +113,7 @@ async function execWithCredentials(
);
await execWithCredentials(args, projectId, gacFilename, {
debug: true,
firebaseToolsVersion,
firebaseToolsVersion
});
} else {
throw e;
Expand All @@ -137,7 +137,7 @@ export async function deployPreview(
"hosting:channel:deploy",
channelId,
...(target ? ["--only", target] : []),
...(expires ? ["--expires", expires] : []),
...(expires ? ["--expires", expires] : [])
],
projectId,
gacFilename,
Expand Down
24 changes: 12 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getInput,
setFailed,
setOutput,
startGroup,
startGroup
} from "@actions/core";
import { context, getOctokit } from "@actions/github";
import { existsSync } from "fs";
Expand All @@ -29,19 +29,19 @@ import {
deployPreview,
deployProductionSite,
ErrorResult,
interpretChannelDeployResult,
interpretChannelDeployResult
} from "./deploy";
import { getChannelId } from "./getChannelId";
import {
getURLsMarkdownFromChannelDeployResult,
postChannelSuccessComment,
postChannelSuccessComment
} from "./postOrUpdateComment";

// Inputs defined in action.yml
const expires = getInput("expires");
const projectId = getInput("projectId");
const googleApplicationCredentials = getInput("firebaseServiceAccount", {
required: true,
required: true
});
const configuredChannelId = getInput("channelId");
const isProductionDeploy = configuredChannelId === "live";
Expand Down Expand Up @@ -93,7 +93,7 @@ async function run() {
const deployment = await deployProductionSite(gacFilename, {
projectId,
target,
firebaseToolsVersion,
firebaseToolsVersion
});
if (deployment.status === "error") {
throw Error((deployment as ErrorResult).error);
Expand All @@ -107,8 +107,8 @@ async function run() {
conclusion: "success",
output: {
title: `Production deploy succeeded`,
summary: `[${hostname}](${url})`,
},
summary: `[${hostname}](${url})`
}
});
return;
}
Expand All @@ -121,7 +121,7 @@ async function run() {
expires,
channelId,
target,
firebaseToolsVersion,
firebaseToolsVersion
});

if (deployment.status === "error") {
Expand Down Expand Up @@ -152,8 +152,8 @@ async function run() {
conclusion: "success",
output: {
title: `Deploy preview succeeded`,
summary: getURLsMarkdownFromChannelDeployResult(deployment),
},
summary: getURLsMarkdownFromChannelDeployResult(deployment)
}
});
} catch (e) {
setFailed(e.message);
Expand All @@ -162,8 +162,8 @@ async function run() {
conclusion: "failure",
output: {
title: "Deploy preview failed",
summary: `Error: ${e.message}`,
},
summary: `Error: ${e.message}`
}
});
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/postOrUpdateComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ export async function postChannelSuccessComment(
) {
const commentInfo = {
...context.repo,
issue_number: context.issue.number,
issue_number: context.issue.number
};

const commentMarkdown = getChannelDeploySuccessComment(result, commit);

const comment = {
...commentInfo,
body: commentMarkdown,
body: commentMarkdown
};

startGroup(`Commenting on PR`);
Expand All @@ -100,7 +100,7 @@ export async function postChannelSuccessComment(
await github.rest.issues.updateComment({
...context.repo,
comment_id: commentId,
body: comment.body,
body: comment.body
});
} catch (e) {
commentId = null;
Expand Down
10 changes: 5 additions & 5 deletions test/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ import {
deployPreview,
deployProductionSite,
ProductionDeployConfig,
ProductionSuccessResult,
ProductionSuccessResult
} from "../src/deploy";
import * as exec from "@actions/exec";
import {
channelError,
channelMultiSiteSuccess,
channelSingleSiteSuccess,
liveDeployMultiSiteSuccess,
liveDeploySingleSiteSuccess,
liveDeploySingleSiteSuccess
} from "./samples/cliOutputs";

const baseChannelDeployConfig: ChannelDeployConfig = {
projectId: "my-project",
channelId: "my-channel",
expires: undefined,
expires: undefined
};

const baseLiveDeployConfig: ProductionDeployConfig = {
projectId: "my-project",
projectId: "my-project"
};

async function fakeExecFail(
Expand Down Expand Up @@ -114,7 +114,7 @@ describe("deploy", () => {

const config: ChannelDeployConfig = {
...baseChannelDeployConfig,
target: "my-second-site",
target: "my-second-site"
};

await deployPreview("my-file", config);
Expand Down
6 changes: 3 additions & 3 deletions test/hash.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
channelSingleSiteSuccess,
channelMultiSiteSuccess,
channelMultiSiteSuccess
} from "./samples/cliOutputs";
import { createDeploySignature } from "../src/hash";

Expand All @@ -18,8 +18,8 @@ describe("hash", () => {
...channelMultiSiteSuccess,
result: {
targetX: channelMultiSiteSuccess.result.target2,
targetY: channelMultiSiteSuccess.result.target1,
},
targetY: channelMultiSiteSuccess.result.target1
}
});
expect(signMulti2).toEqual("980f04126fb629deaadace7d6ee8a0628942e3d3");
});
Expand Down
10 changes: 5 additions & 5 deletions test/postOrUpdateComment.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
singleSiteComment,
multiSiteComment,
notABotComment,
notABotComment
} from "./samples/comments";
import {
getChannelDeploySuccessComment,
createBotCommentIdentifier,
createBotCommentIdentifier
} from "../src/postOrUpdateComment";
import {
channelSingleSiteSuccess,
channelMultiSiteSuccess,
channelMultiSiteSuccess
} from "./samples/cliOutputs";
import { createDeploySignature } from "../src/hash";

Expand Down Expand Up @@ -37,7 +37,7 @@ describe("postOrUpdateComment", () => {
const isCommentByBot = createBotCommentIdentifier(signature);
const testComment = {
user: { type: "Bot" },
body: singleSiteComment,
body: singleSiteComment
};
expect(isCommentByBot(testComment)).toEqual(true);
});
Expand All @@ -47,7 +47,7 @@ describe("postOrUpdateComment", () => {
const isCommentByBot = createBotCommentIdentifier(signature);
const testComment = {
user: { type: "Bot" },
body: notABotComment,
body: notABotComment
};
expect(isCommentByBot(testComment)).toEqual(false);
});
Expand Down
28 changes: 14 additions & 14 deletions test/samples/cliOutputs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ChannelSuccessResult,
ErrorResult,
ProductionSuccessResult,
ProductionSuccessResult
} from "../../src/deploy";

export const commitId = "fe211ff";
Expand All @@ -13,15 +13,15 @@ export const channelMultiSiteSuccess: ChannelSuccessResult = {
site: "my-main-hosting-site",
target: "target1",
url: "https://action-hosting-deploy-demo--multisite-test-goqvngto.web.app",
expireTime: "2020-10-27T21:32:57.233344586Z",
expireTime: "2020-10-27T21:32:57.233344586Z"
},
target2: {
site: "my-second-hosting-site",
target: "target2",
url: "https://action-hosting-deploy-demo-2--multisite-test-ksadajci.web.app",
expireTime: "2020-10-27T21:32:57.233344586Z",
},
},
expireTime: "2020-10-27T21:32:57.233344586Z"
}
}
};

export const channelSingleSiteSuccess: ChannelSuccessResult = {
Expand All @@ -30,30 +30,30 @@ export const channelSingleSiteSuccess: ChannelSuccessResult = {
"action-hosting-deploy-demo": {
site: "action-hosting-deploy-demo",
url: "https://action-hosting-deploy-demo--singlesite-test-jl98rmie.web.app",
expireTime: "2020-10-27T21:32:57.233344586Z",
},
},
expireTime: "2020-10-27T21:32:57.233344586Z"
}
}
};

export const channelError: ErrorResult = {
status: "error",
error:
"HTTP Error: 400, Channel IDs can only include letters, numbers, underscores, hyphens, and periods.",
"HTTP Error: 400, Channel IDs can only include letters, numbers, underscores, hyphens, and periods."
};

export const liveDeploySingleSiteSuccess: ProductionSuccessResult = {
status: "success",
result: {
hosting: "sites/jeff-test-699d3/versions/7aebddc461b66922",
},
hosting: "sites/jeff-test-699d3/versions/7aebddc461b66922"
}
};

export const liveDeployMultiSiteSuccess: ProductionSuccessResult = {
status: "success",
result: {
hosting: [
"sites/action-hosting-deploy-demo/versions/cd71a5c43ba0921b",
"sites/action-hosting-deploy-demo-2/versions/e843c071a09cecbf",
],
},
"sites/action-hosting-deploy-demo-2/versions/e843c071a09cecbf"
]
}
};
Loading