1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00

fix(publish): permissionless dry-run in GHA (#22679)

Fixes https://github.com/denoland/deno/issues/22658
This commit is contained in:
Divy Srivastava 2024-03-06 18:26:20 +05:30 committed by GitHub
parent 89d7bc693a
commit 156950828e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -43,7 +43,13 @@ fn get_gh_oidc_env_vars() -> Option<Result<(String, String), AnyError>> {
pub fn get_auth_method(
maybe_token: Option<String>,
dry_run: bool,
) -> Result<AuthMethod, AnyError> {
if dry_run {
// We don't authenticate in dry-run mode.
return Ok(AuthMethod::Interactive);
}
if let Some(token) = maybe_token {
return Ok(AuthMethod::Token(token));
}

View file

@ -884,7 +884,8 @@ pub async fn publish(
) -> Result<(), AnyError> {
let cli_factory = CliFactory::from_flags(flags).await?;
let auth_method = get_auth_method(publish_flags.token)?;
let auth_method =
get_auth_method(publish_flags.token, publish_flags.dry_run)?;
let import_map = cli_factory
.maybe_import_map()