Repository navigation
Authorize gh api endpoints written with a leading slash - #69
Draft
josephschorr wants to merge 1 commit into
Draft
josephschorr wants to merge 1 commit into
josephschorr wants to merge 1 commit into
Conversation
gh strips a leading slash from an api endpoint, and GitHub's REST docs print endpoints that way, but the gh toolkit only recognized the bare form. A call such as 'gh api -X POST /repos/OWNER/NAME/forks' therefore named no repository and was refused outright, with no approval a person could grant. The slashed and bare spellings now resolve to the same repository; an endpoint that names none still fails closed.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch has not been deployed
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.
Motivation
An agent that needed to fork a repository ran
gh api -X POST /repos/OWNER/NAME/forks. The call was refused outright, twice, with no approval prompt a person could answer. The same call without the leading slash raised an approval and went through.ghaccepts both spellings, and GitHub's REST documentation prints endpoints with the slash, so the refused form is the one an agent is most likely to write.Summary of changes
gh apiendpoints written with a leading slash now resolve to the same repository as the bare form, for both reads and writes.gh api /userand slashed search endpoints are recognized the same way.Alternatives considered
ghitself accepts removes the failure rather than explaining it.Provenance
Ship gate
mage test:unitmage test:integrationmage test:e2eUnit passes. The first integration run had one failure and the first e2e run had three, all in unrelated scenarios and all on a heavily loaded machine. Each of the four passed when re-run on its own. A full re-run of both suites is in progress, and this stays a draft until it is green.
Regeneration
n/a
Coverage
mage test:integration+mage test:e2eare green (pending the re-run above)