我的场景:我在 repo1(这是我拥有此工作流文件的地方)并尝试使用以下代码从 repo 1 中提取 repo 2(两者都在同一组织中):
- name: Checkout aaa-frontend repo
uses: actions/checkout@v2
with:
repository: Orgn1-Global/aaa-frontend
path: develop
token: ${{ github.token }}
从下面的错误中,我假设它能够定位存储库,但只有在定位分支时出现问题。这是正确的吗?
Run actions/checkout@v2
Syncing repository: Orgn1-Global/aaa-frontend
Getting Git version info
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Determining the default branch
Retrieving the default branch name
Not Found
Waiting 17 seconds before trying again
Retrieving the default branch name
Not Found
Waiting 12 seconds before trying again
Retrieving the default branch name
Error: Not Found
从这个 repo 1 中拉出 repo 2 的“主”分支的正确方法是什么?
答案 0 :(得分:1)
下面的代码应该为您获取 main
存储库的 aaa-frontend
分支
- name: Checkout aaa-frontend repo
uses: actions/checkout@v2
with:
repository: Orgn1-Global/aaa-frontend
path: develop
token: ${{ github.token }}
ref: main
答案 1 :(得分:1)
如果我正确理解您的要求,您是否要在 repo1 操作工作流中签出 repo1 和 repo2 ?
如果是 - 它必须是这样的:
# checkout of repo1 - where you have your workflow file
- name: Checkout
uses: actions/checkout@v2
with:
path: main
# checkout repo2 in a folder called my-tools
- name: Checkout tools repo
uses: actions/checkout@v2
with:
repository: my-org/repo2
path: my-tools
您总能在 Github action 公共存储库中找到很棒的示例。这是 checkout 一个。