Skip to content

fix: remove secrets_ prefix from github token envvar key #605

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

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

caroljung-cg
Copy link
Contributor

Motivation

Content

Testing

Please check the following before marking your PR as ready for review

  • I have added tests for my changes
  • I have updated the documentation or added new documentation as needed

@caroljung-cg caroljung-cg requested review from codegen-team and a team as code owners February 21, 2025 18:06
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


codegen-bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@caroljung-cg caroljung-cg merged commit f59804c into develop Feb 21, 2025
15 of 17 checks passed
@caroljung-cg caroljung-cg deleted the fix-secret branch February 21, 2025 18:22
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files

Copy link
Contributor

🎉 This PR is included in version 0.31.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@codegen-team
Copy link
Contributor

Technical Review

This PR makes a consistent change across the codebase to simplify environment variable naming by removing the SECRETS_ prefix from GitHub token-related environment variables.

Changes Overview

  • Renames SECRETS_GITHUB_TOKEN to GITHUB_TOKEN across all files
  • Updates documentation to reflect the new naming convention
  • Updates error messages and warning texts
  • Modifies test configurations to use the new environment variable name

Impact Analysis

  1. Breaking Change: This is a breaking change for existing users who are using SECRETS_GITHUB_TOKEN. A migration guide or deprecation notice should be considered.
  2. Configuration: The SecretsConfig class has been updated to reflect the simpler naming convention.
  3. Testing: Test fixtures have been properly updated to use the new environment variable name.

Suggestions for Improvement

  1. Migration Strategy: Consider adding a fallback mechanism that checks for both GITHUB_TOKEN and SECRETS_GITHUB_TOKEN during a transition period, with a deprecation warning for the old format.
  2. Documentation: Ensure all documentation outside of the code (README, docs, etc.) is updated to reflect this change.
  3. Version Bump: Given this is a breaking change, ensure the version is bumped appropriately following semver.

Code Quality

The changes are consistent and well-structured. The commit maintains a single responsibility and makes the same change pattern across all affected files.

Testing Considerations

While the test files have been updated, it would be beneficial to add tests that verify the behavior when:

  • No token is present
  • Token is present in the new format
  • (If implementing fallback) Token is present in the old format

Falls back to .env file for missing values.
"""

def __init__(self, prefix: str = "", *args, **kwargs) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider implementing a fallback mechanism in the SecretsConfig class to support a graceful transition. Here's a suggested approach:

def __init__(self, prefix: str = "", *args, **kwargs) -> None:
    super().__init__(prefix=prefix, *args, **kwargs)
    
    # Check for deprecated token format
    if self.github_token is None:
        deprecated_token = os.getenv("SECRETS_GITHUB_TOKEN")
        if deprecated_token:
            warnings.warn(
                "Using SECRETS_GITHUB_TOKEN is deprecated and will be removed in a future version. "
                "Please use GITHUB_TOKEN instead.",
                DeprecationWarning,
                stacklevel=2
            )
            self.github_token = deprecated_token

This would provide backward compatibility while encouraging migration to the new format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants