mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 08:09:08 -05:00
fix(publish): permissionless dry-run in GHA (#22679)
Fixes https://github.com/denoland/deno/issues/22658
This commit is contained in:
parent
89d7bc693a
commit
156950828e
2 changed files with 8 additions and 1 deletions
|
@ -43,7 +43,13 @@ fn get_gh_oidc_env_vars() -> Option<Result<(String, String), AnyError>> {
|
||||||
|
|
||||||
pub fn get_auth_method(
|
pub fn get_auth_method(
|
||||||
maybe_token: Option<String>,
|
maybe_token: Option<String>,
|
||||||
|
dry_run: bool,
|
||||||
) -> Result<AuthMethod, AnyError> {
|
) -> Result<AuthMethod, AnyError> {
|
||||||
|
if dry_run {
|
||||||
|
// We don't authenticate in dry-run mode.
|
||||||
|
return Ok(AuthMethod::Interactive);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(token) = maybe_token {
|
if let Some(token) = maybe_token {
|
||||||
return Ok(AuthMethod::Token(token));
|
return Ok(AuthMethod::Token(token));
|
||||||
}
|
}
|
||||||
|
|
|
@ -884,7 +884,8 @@ pub async fn publish(
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let cli_factory = CliFactory::from_flags(flags).await?;
|
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
|
let import_map = cli_factory
|
||||||
.maybe_import_map()
|
.maybe_import_map()
|
||||||
|
|
Loading…
Reference in a new issue