所以我正在尝试构建一个部署操作。我想监听多个存储库中任何一个上的分支合并,当合并发生时我想:
我一切正常,直到操作尝试检查存储库,我收到错误:
Failed to execute git clone --mirror -- '[email protected]:organization/repo1.git' '/home/runner/.cache/composer/vcs/git-github.com-xxxxx.git/'
Cloning into bare repository '/home/runner/.cache/composer/vcs/git-github.com-xxxxx.git'...
Warning: Permanently added the ECDSA host key for IP address 'XXX.XX.XXX.X' to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
在 yaml 中我有:
name: composer update action
uses: kawax/composer-update-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_NAME: myorganization
GIT_EMAIL: [email protected]
COMPOSER_PACKAGES: north*
我尝试使用 php-composer-v6 但遇到同样的错误。有多个存储库,因此部署密钥似乎不是正确的解决方案。
这里是composer.json中存储库条目的示例:
"repositories": {
"0": {
"type": "vcs",
"url": "[email protected]:organization/repo1.git",
"no-api": true
},
"1": {
"type": "vcs",
"url": "[email protected]:organization/repo2.git",
"no-api": true
},
有很多存储库 - 九个。
我们将创建一个 SSH 密钥(生成它),然后向您的组织添加一个“bot”用户,为其提供此 SSH 密钥,然后将该用户作为协作者添加到其他 github 存储库中。您只需创建一个新的用户帐户即可委派访问权限。再次与我之前评论中的链接进行比较。当使用该 Github 用户运行该操作时,将授予对存储库的访问权限。否则,该操作需要具有 SSH 密钥,可以使用与 GITHUB_TOKEN 相当的秘密来完成。 - hakre 回答了这个问题