X Tutup
Skip to content

gh auth login: added flags to partially automate flow#5158

Merged
mislav merged 6 commits intocli:trunkfrom
jonathan-enf:authflow
Feb 17, 2022
Merged

gh auth login: added flags to partially automate flow#5158
mislav merged 6 commits intocli:trunkfrom
jonathan-enf:authflow

Conversation

@jonathan-enf
Copy link
Copy Markdown
Contributor

@jonathan-enf jonathan-enf commented Feb 2, 2022

Motivation: I maintain a tool that implements a specific workflow using git and gh. A few of my users were
confused by the various options presented by the "gh auth login" flow, so I would like to add these command
line flags that can be optionally used to reduce the number of prompts the user is shown.

For example, if I know that I want all my users to not use GitHub Enterprise, and to use SSH to authenticate to
git, then my wrapper tool would run:

 gh auth login --use-gh --use-ssh

Then the users are only prompted for the remaining necessary items.

I also modified the flow so that if web-based authentication fails (ie if the user is trapped in text mode), gh auth login automatically falls over to prompting the user to paste a token. This step, too, will reduce the number of support calls I have to respond to by one.

Tested by recompiling and manually retesting the gh tool.

@jonathan-enf jonathan-enf requested a review from a team as a code owner February 2, 2022 18:29
@jonathan-enf jonathan-enf requested review from mislav and removed request for a team February 2, 2022 18:29
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Feb 2, 2022
@cliAutomation
Copy link
Copy Markdown
Collaborator

Hi! Thanks for the pull request. Please ensure that this change is linked to an issue by mentioning an issue number in the description of the pull request. If this pull request would close the issue, please put the word 'Fixes' before the issue number somewhere in the pull request body. If this is a tiny change like fixing a typo, feel free to ignore this message.

@mislav
Copy link
Copy Markdown
Contributor

mislav commented Feb 2, 2022

Hi, thanks for maintaining a tool that wraps gh!

For clarification: gh auth login will still get invoked interactively (i.e. with its stdin and stdout connected to a user's terminal) for your users; you just want to pre-define some defaults so they see fewer prompts?

@mislav mislav self-assigned this Feb 2, 2022
@jonathan-enf
Copy link
Copy Markdown
Contributor Author

For clarification: gh auth login will still get invoked interactively (i.e. with its stdin and stdout connected to a user's terminal) for your users; you just want to pre-define some defaults so they see fewer prompts?

That is correct.

@jonathan-enf jonathan-enf requested a review from mislav February 10, 2022 20:28
Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thank you! I've pushed some tweaks to simplify.

@mislav mislav enabled auto-merge (squash) February 17, 2022 19:27
@mislav mislav merged commit 1eefda0 into cli:trunk Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup