How to run gh auth login --with-token on Windows with PowerShell?
#8616
Replies: 2 comments 2 replies
-
|
To run gh auth login --with-token on Windows with PowerShell in a GitHub Actions workflow, you can use the following example: |
Beta Was this translation helpful? Give feedback.
-
|
The PowerShell shape does work, but the syntax is PowerShell-specific. I just verified that piping a value into: gh auth login --with-tokenis accepted as standard input by So the practical forms are: If the token is already in an environment variable: $env:GH_TOKEN | gh auth login --with-tokenIf it is in a file: Get-Content .\mytoken.txt | gh auth login --with-tokenThe main thing to avoid is mixing cmd redirection syntax into PowerShell. So my short answer would be:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I can't get it to work in any way:
echo ${{ secrets.GH_TOKEN }} | gh auth login --with-tokenresults inA positional parameter cannot be found that accepts argument 'auth'.Or `Cannot run a document in the middle of a pipeline: C:\hostedtoolcache\windows\gh-cli\2.32.0\x64\bin\gh.cmd /c "gh auth login --with-token < $(echo ***)"results inThe system cannot find the file specified.How do I get it to work with PowerShell?
Beta Was this translation helpful? Give feedback.
All reactions