-
Couldn't load subscription status.
- Fork 7.3k
Require repo disambiguation for secret commands #10209
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
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8898837
Add remote check to secret commands
wingleung 57c9ee0
Add tests for secret commands
wingleung 3de2fd9
Prompt for secret commands
wingleung cad5903
Update docs for set-default
wingleung 0be5720
Update setdefault test
wingleung df8bb51
Always prompt on secret set when multiple remotes
williammartin 73244c0
Move secret repo validation into secrets subpackage
williammartin 870da79
Use smarter base repo funcs for secret commands
williammartin 4da4c82
Rename secret BaseRepo func
williammartin d831e3e
Remove validated TODO and add review warning
williammartin 5630252
Add acceptance test for secrets remote disambiguation
williammartin ce47fab
Move secret base repo prompting earlier
williammartin a47327a
Secret base repo prompting should not use resolved remote
williammartin b382b24
Print informative message before prompting for secret repo
williammartin 88a64d2
Change wording on secret repo prompt
williammartin e7ffb1e
Fix typo in secret base repo selection comment
williammartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
acceptance/testdata/secret/secret-require-remote-disambiguation.txtar
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Set up env vars | ||
| env REPO=${SCRIPT_NAME}-${RANDOM_STRING} | ||
|
|
||
| # Use gh as a credential helper | ||
| exec gh auth setup-git | ||
|
|
||
| # Create a repository with a file so it has a default branch | ||
| exec gh repo create ${ORG}/${REPO} --add-readme --private | ||
|
|
||
| # Defer repo cleanup | ||
| defer gh repo delete --yes ${ORG}/${REPO} | ||
|
|
||
| # Create a fork | ||
| exec gh repo fork ${ORG}/${REPO} --org ${ORG} --fork-name ${REPO}-fork | ||
|
|
||
| # Defer fork cleanup | ||
| defer gh repo delete --yes ${ORG}/${REPO}-fork | ||
|
|
||
| # Sleep to allow the fork to be created before cloning | ||
| sleep 2 | ||
|
|
||
| # Clone and move into the fork repo | ||
| exec gh repo clone ${ORG}/${REPO}-fork | ||
| cd ${REPO}-fork | ||
|
|
||
| # Secret list requires disambiguation | ||
| ! exec gh secret list | ||
| stderr 'multiple remotes detected. please specify which repo to use by providing the -R, --repo argument' | ||
|
|
||
| # Secret set requires disambiguation | ||
| ! exec gh secret set 'TEST_SECRET_NAME' --body 'TEST_SECRET_VALUE' | ||
| stderr 'multiple remotes detected. please specify which repo to use by providing the -R, --repo argument' | ||
|
|
||
| # Secret delete requires disambiguation | ||
| ! exec gh secret delete 'TEST_SECRET_NAME' | ||
| stderr 'multiple remotes detected. please specify which repo to use by providing the -R, --repo argument' |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I assume this was moved higher up so any ambiguity errors are raised earlier before the other ways this can error.
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.
Yeh, similar to #10209 (comment) I just wanted the repo disambiguation frontloaded to avoid going through a bunch of steps only to discover this at the end.