fix: strip owner prefix from --repo before sending to GitHub access_tokens API#4
Merged
Merged
Conversation
…okens API
GitHub's POST /app/installations/{id}/access_tokens `repositories` field
expects bare repo names ("clagentic-directory"), not "owner/name" form.
The installation is org-scoped via installation_id, so the owner is implicit.
Add parseRepoName() helper that accepts "owner/name" or bare "name" input
and returns the bare name. Empty, multi-slash, or malformed inputs return a
descriptive error before any API call is made.
The --repo CLI flag contract is unchanged: callers continue to pass
"owner/name" (e.g. clagentic/clagentic-directory). Only the value sent to
GitHub becomes the bare name segment.
Before: repositories: ["clagentic/clagentic-directory"] -> GitHub 422
After: repositories: ["clagentic-directory"] -> token minted correctly
Also update Makefile to explicitly set GOPATH/GOMODCACHE/GOCACHE (matching
the relay project pattern) so `make test` resolves the Go module cache
without requiring GOPATH in the invoking environment.
Tests: table-driven unit tests for parseRepoName (all documented edge cases)
plus two integration-level tests capturing what is sent to a stub GitHub API.
All tests pass (`make test`).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See PR description