Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Conversation

@ethanis
Copy link
Member

@ethanis ethanis commented Jun 1, 2022

What's changing?

This updates the update command to accept the PAT to auth with ghcr.io as standard input, to mirror the behavior of docker login .... This has the benefit of keeping PATs away from terminal history.

How's this tested?

Build the executable:

$ dotnet build src/Valet.sln
$ dotnet publish src/Valet/Valet.csproj -c Release -r osx-x64 --self-contained -o dist/osx-x64 --no-restore -p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true

then pipe input to the update command:

$ echo $GITHUB_PAT | dist/osx-x64/gh-valet update --username $GITHUB_USERNAME --password-stdin

Closes #40

cc/ @korosuke613

@github-actions
Copy link

github-actions bot commented Jun 1, 2022

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
9 tests ±0  9 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 202c1fe. ± Comparison against base commit 34e0241.

♻️ This comment has been updated with latest results.

@ethanis ethanis marked this pull request as ready for review June 1, 2022 23:42
@ethanis ethanis requested a review from a team as a code owner June 1, 2022 23:42
@ethanis ethanis requested review from j-dunham and luke-engle June 1, 2022 23:42
@j-dunham
Copy link
Contributor

j-dunham commented Jun 2, 2022

Am I missing something? I thought I would get a failed authentication or something. Does the same if I provide valid PAT

gh-valet on  update-password-stdin 
❯ export GITHUB_PAT=1234                                                                 

gh-valet on  update-password-stdin 
❯ echo $GITHUB_PAT                                                         
1234

gh-valet on  update-password-stdin 
❯ echo $GITHUB_PAT | dist/osx-x64/gh-valet update --username $GITHUB_USERNAME --password-stdin
INFO: using cached credentials because no GHCR credentials were provided.

@ethanis
Copy link
Member Author

ethanis commented Jun 2, 2022

| dist/osx-x64/gh-valet update --username $GITHUB_USERNAME --password-stdin

@j-dunham Is the GITHUB_USERNAME env variable set? If it's nil, then Valet will still default to using whatever credentials are cached by docker

@j-dunham
Copy link
Contributor

j-dunham commented Jun 2, 2022

| dist/osx-x64/gh-valet update --username $GITHUB_USERNAME --password-stdin

@j-dunham Is the GITHUB_USERNAME env variable set? If it's nil, then Valet will still default to using whatever credentials are cached by docker

That did the trick!

Copy link
Contributor

@j-dunham j-dunham left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@luke-engle luke-engle left a comment

Choose a reason for hiding this comment

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

Works like a charm 💎

@ethanis ethanis merged commit f204b8d into main Jun 2, 2022
@ethanis ethanis deleted the update-password-stdin branch June 2, 2022 18:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --password-stdin option to gh valet update

4 participants