带有私有仓库和私有仓库的 Github 工作流程标签
我在这里问了这个问题,但没有得到回应: https:// github.community/t/private-repo-w-tag-in-workflow/229573
我们有三个私有存储库,其中 package.json 中的标签作为依赖项,一个示例:
"Private-Repo1": "https://
我们使用 oauth 密钥来访问我们的存储库。我的 PAT 设置为允许检查存储库以及工作流程访问。
当我们运行工作流操作时,该行在 npm ci
处失败,并出现错误:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ***github.com/project/Private-Repo.git
npm ERR! remote: Repository not found.
npm ERR! fatal: repository 'https://github.com/project/Private-Repo.git/' not found
本地测试指出我们失败的原因是 git ls-remote 会失败,如果我删除标签,它就会起作用。
我们如何使用 PAT 通过 package.json 从工作流程中的私有存储库中提取特定标签?我能找到的所有内容都是如何访问私人仓库,但不是如何访问私人仓库的标签。
I asked this question here and got no response: https://github.community/t/private-repo-w-tag-in-workflow/229573
We have three private repos with tags in our package.json as dependencies, one example:
"Private-Repo1": "https://<PAT>:[email protected]/project/Private-Repo.git#v1.0.0",
We use oauth keys to access our repos. My PAT is set to allow checking out the repo as well as workflow access.
When we run our Workflow action, it fails at npm ci
for this line with an error of:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ***github.com/project/Private-Repo.git
npm ERR! remote: Repository not found.
npm ERR! fatal: repository 'https://github.com/project/Private-Repo.git/' not found
Local testing is pointing to the reason that we’re failing is that git ls-remote
fails when you point to a private repo with a tag number, if I remove the tag it works.
How can we use a PAT to pull a specific tag from a private repo in our workflow via our package.json? Everything I can find is how to access a private repo, but not how to access a private repo's tag.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题不是 git ls-remote 而是令牌。我在错误的地方调用了它。它需要在结帐步骤中设置,而不是在设置节点步骤中设置。这是我的工作 yaml,它允许我使用使用 oauth 令牌的私有存储库和标签来运行工作流程。唯一需要的设置是创建一个名为 GIT_TOKEN (或任何您想要的名称)的秘密并为其提供工作流访问权限。
The problem wasn't
git ls-remote
it was the token. I was calling it in the wrong place. It needs to be set in the checkout step, not setup-node step. Here is my working yaml that allows me to run a workflow with a private repo and tag that uses an oauth token. The only setup needed is to make a secret called GIT_TOKEN (or whatever you want to call it) and give it workflow access.更快的方法是在
- run: npm ci
之前添加以下步骤:A faster way is to add the following steps before
- run: npm ci
: