-
Notifications
You must be signed in to change notification settings - Fork 222
Thad castl3 main #428
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
Thad castl3 main #428
Conversation
…e your bill, such as minimum instances required.
Co-authored-by: Bryan Kendall <[email protected]>
…port for channel site deployment with force flag. Updated tests to and types to account for force flags. Force flag is now optional on ProductionDeployConfig and ChannelDeployConfig. Simplified deploy calls using force flag to automatically append force based on the boolean value nad removed the force-specific branch in index.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @bkendall, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a new force input to the GitHub Action, enabling users to bypass interactive prompts and warnings during Firebase deployments by passing the --force flag to firebase-tools commands. This enhancement streamlines continuous deployment workflows by allowing fully automated deployments without manual intervention. The changes involve updating the action's configuration, core deployment logic, and type definitions, along with adding comprehensive test coverage for the new functionality.
Highlights
- New
forceinput for Firebase deployments: A newforceinput has been added to theaction.ymlfile. This input, when set totrue, will instruct the action to use the--forceflag during Firebase deployments, bypassing interactive prompts and warnings. - Integration of
--forceflag into deployment commands: The core logic withinbin/action.min.js,src/deploy.ts, andsrc/index.tshas been updated to correctly interpret and pass the--forceflag tofirebase-toolscommands. This ensures that deployments proceed without requiring manual confirmation, which is crucial for automated CI/CD pipelines. - Enhanced type definitions for force deployments: New TypeScript types (
ForceProductionSuccessResult,ForceChannelSuccessResult) and modifications to existing deployment configuration types (DeployConfig,ChannelDeployConfig,ProductionDeployConfig) have been introduced insrc/deploy.ts. This enhances type safety and clarity when handling theforceoption throughout the codebase. - Expanded test coverage for
--forcefunctionality: Comprehensive unit tests have been added and updated intest/deploy.test.tsto cover scenarios where the--forceflag is used. These tests verify that the flag is correctly applied for both preview channel and production site deployments, ensuring the reliability of this new feature.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a force flag to allow bypassing prompts during Firebase deployment. The overall approach in the TypeScript source files is sound, but there are several issues that need attention. Most critically, the compiled JavaScript file (bin/action.min.js) is out of sync with the source code and contains an incorrect implementation. Additionally, there are redundant type definitions in src/deploy.ts and a bug in one of the new test cases in test/deploy.test.ts. Addressing these points will improve the quality and correctness of the changes.
bin/action.min.js
Outdated
| async function deployWithForce(gacFilename, deployConfig) { | ||
| const { | ||
| projectId, | ||
| target, | ||
| firebaseToolsVersion, | ||
| force | ||
| } = deployConfig; | ||
| const deploymentText = await execWithCredentials(["deploy", "--only", `hosting${target ? ":" + target : ""}`, "--force"], projectId, gacFilename, { | ||
| firebaseToolsVersion, | ||
| force | ||
| }); | ||
| const deploymentResult = JSON.parse(deploymentText); | ||
| return deploymentResult; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This compiled file appears to be out of sync with the TypeScript source files (src/index.ts and src/deploy.ts). It contains a deployWithForce function and a special if (force) block in the main run function, which are not present in the source and represent an incorrect implementation approach. The logic in src/index.ts correctly passes the force flag to the existing deploy functions, which is the right way to do it.
Please run the build process to update this file from the TypeScript source. The current state of this file will cause incorrect behavior.
src/deploy.ts
Outdated
| export type ForceProductionSuccessResult = { | ||
| status: "success"; | ||
| result: { | ||
| hosting: string | string[]; | ||
| }; | ||
| }; | ||
|
|
||
| export type ForceChannelSuccessResult = { | ||
| status: "success"; | ||
| result: { [key: string]: SiteDeploy }; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const config: ChannelDeployConfig = { | ||
| ...baseChannelDeployConfig, | ||
| target: "my-second-site", | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case is intended to check that --force is used when a target is provided. However, the config object is created from baseChannelDeployConfig, which does not set force: true. As a result, the expectation on line 181 that deployFlags contains "--force" will fail. You should add force: true to the configuration for this test.
| const config: ChannelDeployConfig = { | |
| ...baseChannelDeployConfig, | |
| target: "my-second-site", | |
| }; | |
| const config: ChannelDeployConfig = { | |
| ...baseChannelDeployConfig, | |
| target: "my-second-site", | |
| force: true, | |
| }; |
| export type ChannelDeployConfig = DeployConfig & { | ||
| expires: string; | ||
| channelId: string; | ||
| force?: boolean; | ||
| }; | ||
|
|
||
| export type ProductionDeployConfig = DeployConfig & {}; | ||
|
|
||
| export type ProductionDeployConfig = DeployConfig & { | ||
| force?: boolean; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The force?: boolean property is already defined in the base DeployConfig type on line 60. It's redundant to declare it again in ChannelDeployConfig and ProductionDeployConfig since they extend DeployConfig.
| export type ChannelDeployConfig = DeployConfig & { | |
| expires: string; | |
| channelId: string; | |
| force?: boolean; | |
| }; | |
| export type ProductionDeployConfig = DeployConfig & {}; | |
| export type ProductionDeployConfig = DeployConfig & { | |
| force?: boolean; | |
| }; | |
| export type ChannelDeployConfig = DeployConfig & { | |
| expires: string; | |
| channelId: string; | |
| }; | |
| export type ProductionDeployConfig = DeployConfig & {}; |
80eb0c9 to
561f0e1
Compare
(This is just a shadow PR to see if the actions actually work)