我在仓库
knowyrtech/repo1
中有 github 操作,我在其中签出 knowyrtech/repo2
,如下所示:
- name: Checkout code from a specific repository and branch
uses: actions/checkout@v3
with:
repository: knowyrtech/repo2 # Replace with the repository you want to checkout
ref: release/valtech
我希望访问 Windows github 运行程序上签出
repo2
的目录。
我使用了
${{ github.workspace }}
,但它带我到了<runner work directory>/repo1/repo1
,而我看到repo2的签出文件夹可能在这里<runner work directory>/repo1/repo2
。
您能否建议我如何进入签出远程
repo2
的文件夹?
由于您在运行程序中使用多个存储库(
repo1/repo1
和repo1/repo2
),因此您可以使用path
中的actions/checkout
选项。
路径
$GITHUB_WORKSPACE 下放置存储库的相对路径
https://github.com/actions/checkout#usage
- name: Checkout
uses: actions/checkout@v4
with:
path: repo1
- name: Checkout knowyrtech/repo2 repo
uses: actions/checkout@v4
with:
repository: knowyrtech/repo2
ref: release/valtech
path: repo2
这样,您将在
repo1
下拥有主存储库,在 repo2
下拥有第二个存储库。