Skip to main content

is_valid_github_identity

Function is_valid_github_identity 

Source
pub fn is_valid_github_identity(name: &str) -> bool
Expand description

Whether name matches the owner/repo GitHub identifier shape every GitHub-tags-backed ecosystem accepts.

Accepts [a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+, with neither segment being exactly ./.. (see is_dot_segment).

Shared by each ecosystem’s registry::validate_owner_repo (a credential-bearing fetch-URL gate) and its formatter’s display-URL gate, so the two predicates cannot drift out of sync on what counts as a valid identity.

§Examples

use deps_core::github::is_valid_github_identity;

assert!(is_valid_github_identity("actions/checkout"));
assert!(!is_valid_github_identity("not-a-valid-identifier"));
assert!(!is_valid_github_identity("owner/.."));