-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat(vcs): parse API credentials from (push) repository URL #12466
Conversation
This allows using fine-grained access tokens instead of instance scoped access. Fixes WeblateOrg#12439
WalkthroughThe changes in this pull request enhance the documentation and functionality of the API credential management system. Key updates include clarifications on overriding API credentials in specific sections of the configuration, improvements to the parsing of repository URLs to include username and password, and the addition of new test cases to ensure the accuracy of these changes. Overall, these modifications aim to improve user understanding and the robustness of the credential management process. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Weblate
participant GitLab
User->>Weblate: Push changes with repo URL
Weblate->>GitLab: Parse repo URL for credentials
GitLab-->>Weblate: Return parsed credentials
Weblate->>Weblate: Validate and use credentials
Weblate->>GitLab: Create merge request
GitLab-->>Weblate: Confirm merge request creation
Assessment against linked issues
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (4)
Additional comments not posted (6)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
docs/admin/config.rst (1)
2118-2121
: LGTM, but please fix the line numbers.The changes to the documentation are approved. The added clarification about API credential precedence is very helpful.
However, looks like the line numbers got a bit messed up, likely because the entire file was provided for context instead of a diff. The actual changes are at the end of the file. Please update the line numbers to match the correct location of the changes.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- docs/admin/config.rst (1 hunks)
- docs/changes.rst (1 hunks)
- weblate/vcs/git.py (9 hunks)
- weblate/vcs/tests/test_vcs.py (1 hunks)
Additional comments not posted (6)
docs/changes.rst (1)
9-9
: LGTM!The changes to the release notes are approved.
weblate/vcs/git.py (3)
Line range hint
805-834
: Approved: Changes toparse_repo_url
look good.The changes to expand the return type and extract
username
andpassword
from the repository URL are reasonable enhancements to support URLs with embedded credentials. The implementation looks correct.
Line range hint
883-904
: Approved: Changes toget_credentials
look good.The updates to
get_credentials
correctly handle the expanded return type ofparse_repo_url
. Defaulting to the credentials dictionary forusername
andpassword
if not available in the URL is a sensible fallback.
Line range hint
1220-1246
: Approved: Changes toAzureDevOpsRepository.parse_repo_url
look good.The updates to unpack the expanded return value and split the URL path to extract
owner
andslug
are correct. This matches the changes in the baseparse_repo_url
implementation.weblate/vcs/tests/test_vcs.py (2)
1368-1379
: LGTM!The new
test_parse_repo_url
test method looks good. It covers parsing different Git repository URL formats and checks that theparse_repo_url
method returns the expected structured output.
1373-1374
: LGTM!The additional test case for parsing the "github.com:WeblateOrg/test.github.io" repository URL looks good. It improves the test coverage.
Proposed changes
This allows using fine-grained access tokens instead of instance scoped access.
Fixes #12439
Checklist
Other information
Summary by CodeRabbit
Documentation
New Features
Tests
parse_repo_url
functionality.