I installed Github CLI via homebrew so that I can download files via Run Scripts in Xcode.
I did the gh auth login dance via a Terminal window, so I thought my credentials are saved locally. Because after I do this, I can download files via the terminal prompt.
So I guess I'm missing something; I'm running scripts via Xcode build phases, and the authentication check fails.
if ! gh auth status >/dev/null 2>&1; then
echo "You need to authenticate Github CLI. From a Terminal window: gh auth login"
exit 1
fi
So how do I pass whatever credentials are saved locally into this script / or how do I make a successful authentication work in this context, so that the script itself doesn't contain any sensitive information and I'm also not required to authenticate again, so I can grab a file I need via:
gh api "/repos/mycompany/myrepo/contents/README.md" -H "Accept: application/vnd.github.raw" > README.md
Thanks for any help!