英文:
Using npm set config _auth with a GitHub Secret fails
问题
以下是您要翻译的内容:
"run"部分中的以下npm配置设置在我的GitHub操作中不起作用。
npm config set //my.registry.io/npm/:_auth {{ secret.NPM_ACCESSTOKEN }}
我知道secret.NPM_ACCESSTOKEN
的值是正确的,我已经能够通过另一种方法进行验证。
但是我需要使用npm config set _auth value
方法,而不是使用".npmrc"。
例如,我尝试了各种方法:
token=$(echo "$(curl -u "$UsernameKey" $Uri)" | extract_token()
npm config set _auth $token
这将返回与存储在GitHub Secrets中的值完全相同,并且可以成功工作。但这意味着我需要使用curl进行额外的请求。
英文:
The following npm config set, in my "run" section does not work in my GitHub action.
npm config set //my.registry.io/npm/:_auth {{ secret.NPM_ACCESSTOKEN }}
I know the value of secret.NPM_ACCESSTOKEN
is correct, I've been able to verify with an alternative method.
However I need to use the npm config set _auth value
method instead of using a ".npmrc".
I've tried a variety of methods for example:
token=$(echo "$(curl -u "$UsernameKey" $Uri)" | extract_token()
npm config set _auth $token
This returns me exactly the same value as the one stored in GH secrets and works successfully. However means I'm making an additional request with the curl.
答案1
得分: 1
After double checking all the secrets and passing them into an env (via GitHub) action. The following was the working solution.
Note that I did provide single quotes around the env.NPM_ACCESSTOKEN
and _auth
instead _authToken
worked for me. (thanks @azeem)
npm config set //my.jrog.io/npm/:_auth '{{ env.NPM_ACCESSTOKEN }}'
npm config set strict-ssl false
npm config set email ${{ env.NPM_USERNAME }}@email.com
npm config set registry https://my.jrog.io/npm/npm
英文:
After double checking all the secrets and passing them into an env (via GitHub) action. The following was the working solution.
Note that I did provide single quotes around the env.NPM_ACCESSTOKEN
and _auth
instead _authToken
worked for me. (thanks @azeem)
npm config set //my.jrog.io/npm/:_auth '${{ env.NPM_ACCESSTOKEN }}'
npm config set strict-ssl false
npm config set email ${{ env.NPM_USERNAME }}@email.com
npm config set registry https://my.jrog.io/npm/npm
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论