运行 firebase 登录时如何跳过`(Y/n)` 提示

How to skip `(Y/n)` prompt when running firebase login

我正在尝试在我的持续集成中设置 firebase CLI(travis-ci,这并不重要),我不可避免地必须登录 firebase。

$ firebase login --token FIREBASE_TOKEN --no-localhost
]0;Firebase CLIi  Firebase optionally collects CLI usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.
? Allow Firebase to collect CLI usage and error reporting information? (Y/n) 

因为它只是 travis-ci,所以它无法对该提示回答是或否,这会挂起并终止构建。

我检查了 firebase login--help,这是我得到的:

> firebase login --help
Usage: firebase login [options]

log the CLI into Firebase

Options:
  --no-localhost  copy and paste a code instead of starting a local server for authentication
  --reauth        force reauthentication even if already logged in
  -h, --help      output usage information

所以似乎没有任何类型的覆盖标志,如 -y 或任何东西。

如果无法跳过此提示,我该如何在持续构建中登录 firebase?或者,如何跳过此提示?

我认为它不会复杂,因为 Firebase's own docs 中概述了对 "CI Systems" 的支持。

编辑:尝试 login:ci

$ firebase login:ci --token $FIREBASE_TOKEN
]0;Firebase CLI
Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=...
Waiting for authentication...

文档指示您使用 login:ci 直接在命令行中使用 CI 环境提供令牌。您正在使用 login,它适用于交互式 shell。

如果您 运行 使用标志 --token 命令,则不需要 firebase login

$ curl -sL https://firebase.tools | bash
-- Checking for existing firebase-tools on PATH...
-- Checking your machine type...
-- Downloading binary from https://firebase.tools/bin/linux/latest
######################################################################## 100.0%
-- Setting permissions on binary...
-- Checking your PATH variable...
-- firebase-tools@]0;Firebase CLI8.4.1 is now installed
-- All Done!
before_install.2
$ firebase firestore:delete --token $FIREBASE_TOKEN --all-collections --project $PROJECT_ID -y
]0;Firebase CLIDeleting the following collections: