Skip to content

Conversation

@filipchristiansen
Copy link
Contributor

  • Drop InvalidGitHubTokenError
  • validate_github_token now emits a UserWarning instead of raising
  • Update tests to:
    • assert no warnings for valid tokens (via recwarn)
    • expect UserWarning for malformed tokens
  • Reduces false-positives and is future-proof if GitHub introduces new token formats

Closes #380

* Drop `InvalidGitHubTokenError` * `validate_github_token` now emits a `UserWarning` instead of raising * Update tests to: * assert no warnings for valid tokens (via `recwarn`) * expect `UserWarning` for malformed tokens * Reduces false-positives and is future-proof if GitHub introduces new token formats Closes #380
"""
if not re.fullmatch(_GITHUB_PAT_PATTERN, token):
raise InvalidGitHubTokenError
warnings.warn(
Copy link
Contributor

@ix-56h ix-56h Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to validate the token with pattern matching and the warning is useless here i guess.
When the token is invalid (malformed or just invalid) we correctly handle the error:
image

I don't see why we validate and log the validation result here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the validation is informative. Just a little message saying "this does not look like a proper token, tokens usually start with gh_ blablabla" because yeah, believe me, i've seen too many people struggle with access tokens and just put their plain password or something

@filipchristiansen filipchristiansen marked this pull request as draft July 11, 2025 18:39
@github-actions
Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link

Hi there! We haven’t seen activity on this pull request for 45 days, so I’m marking it as stale.
If you’d like to keep it open, please leave a comment within 10 days. Thanks!

@github-actions github-actions bot added the stale label Sep 10, 2025
@github-actions
Copy link

Hi there! We haven’t heard anything for 10 days, so I’m closing this pull request. Feel free to reopen if you’d like to continue working on it. Thanks!

@github-actions github-actions bot closed this Sep 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment