-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix issue with init hosting prompts #9404
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,10 +46,10 @@ | |
| * - Writes GitHub workflow yaml configuration files that reference the newly created secret | ||
| * to configure the Deploy to Firebase Hosting GitHub Action | ||
| * - https://github.com/marketplace/actions/deploy-to-firebase-hosting | ||
| * - https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | ||
| * | ||
| * @param setup A helper object provided by the `firebase init` command. | ||
| * @param config Configuration for the project. | ||
|
Check warning on line 52 in src/init/features/hosting/github.ts
|
||
| * @param options Command line options. | ||
| */ | ||
| export async function initGitHub(setup: Setup): Promise<void> { | ||
|
|
@@ -57,7 +57,7 @@ | |
| return reject("Could not determine Project ID, can't set up GitHub workflow.", { exit: 1 }); | ||
| } | ||
|
|
||
| if (!setup.config.hosting) { | ||
| if (!setup.config.hosting && !setup.featureInfo?.hosting) { | ||
| return reject( | ||
| `Didn't find a Hosting config in firebase.json. Run ${bold("firebase init hosting")} instead.`, | ||
| ); | ||
|
|
@@ -82,10 +82,10 @@ | |
|
|
||
| // Get GitHub user Details | ||
| const userDetails = await getGitHubUserDetails(ghAccessToken); | ||
| const ghUserName = userDetails.login; | ||
|
|
||
| logger.info(); | ||
| logSuccess(`Success! Logged into GitHub as ${bold(ghUserName)}`); | ||
| logger.info(); | ||
|
|
||
| // Prompt for repo and validate by getting the public key | ||
|
|
@@ -132,11 +132,11 @@ | |
|
|
||
| // If the developer is using predeploy scripts in firebase.json, | ||
| // remind them before they set up a script in their workflow file. | ||
| if (!Array.isArray(setup.config.hosting) && setup.config.hosting.predeploy) { | ||
| if (!Array.isArray(setup.config.hosting) && setup.config.hosting?.predeploy) { | ||
| logBullet(`You have a predeploy script configured in firebase.json.`); | ||
| } | ||
|
|
||
| const { script } = await promptForBuildScript(setup?.hosting?.useWebFrameworks); | ||
|
|
||
| const ymlDeployDoc = loadYMLDeploy(); | ||
|
|
||
|
|
@@ -158,8 +158,8 @@ | |
| githubSecretName, | ||
| setup.projectId, | ||
| script, | ||
| setup?.hosting?.useWebFrameworks, | ||
| setup?.hosting?.source, | ||
| ); | ||
|
|
||
| logger.info(); | ||
|
|
@@ -193,8 +193,8 @@ | |
| githubSecretName, | ||
| setup.projectId, | ||
| script, | ||
| setup?.hosting?.useWebFrameworks, | ||
| setup?.hosting?.source, | ||
| ); | ||
|
|
||
| logger.info(); | ||
|
|
@@ -219,7 +219,7 @@ | |
| * For example, if the .git folder is /Users/sparky/projects/my-web-app/.git | ||
| * This function will return /Users/sparky/projects/my-web-app | ||
| * | ||
| * Modeled after https://github.com/firebase/firebase-tools/blob/master/src/detectProjectRoot.ts | ||
| * | ||
| * @return {string} The folder that contains the .git folder | ||
| */ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we still need to keep this in here instead of allowing it into actuate - initGithub includes interactive prompts, and we need actuate to be safe to run noninteractively
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.
I'm not sure if can move
initGitHubintoaskQuestions.initGitHubusessetup.config.hostinga couple of times, which is only set duringactuate.firebase-tools/src/init/features/hosting/github.ts
Lines 60 to 64 in be433bc
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.
Updated, moved
initGitHubintoaskQuestions.It looks like the only scenario
Didn't find a Hosting config in firebase.jsonwill error out is during the setup of a fresh project, otherwise it will correctly pick up the existing config.During the initial set up with a blank project, I think we can instead use
setup.featureInfo?.hostingifsetup.config.hostingdoes not have values