7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GitHub Actions で GitHub 内の他のリポジトリを checkoutする

Last updated at Posted at 2020-04-29

GitHub Actions で GitHub 内の他のリポジトリを clone する

以下のように actions/checkout@v2 に対して repository で checkout するリポジトリと path で checkout 先のディレクトリを指定することで GitHub 内の他のリポジトリを clone できます。
この例では https://github.com/accountname/reponamereponame のディレクトリに checkout します。(clone と書いていたけど checkout かも。未確認)

    - name: Checkout other repo
      uses: actions/checkout@v2
      with:
        repository: accountname/reponame
        path: reponame

上記指定は複数指定できるので、何個でも checkout するリポジトリを増やせます。

以下は .github/workflows/main.yml の全体です。テンプレートに上記を追加して不要な項目削除したもの。

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2

    - name: Checkout other repo
      uses: actions/checkout@v2
      with:
        repository: accountname/reponame
        path: reponame

参考サイト

以下を見るとほかの指定方法とかも説明があります。
https://github.com/actions/checkout#checkout-multiple-repos-side-by-side

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?