Skip to content
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

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

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cli/tools/registry/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
3 changes: 2 additions & 1 deletion cli/tools/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,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()
Expand Down