GitHub Actionsを使っているとき、あまり container:
を指定することはないかもしれませんが、例えば以下のように ubuntu:bionic
を指定して事前にGitをインストールした上で actions/checkout@v2
を実行したとき
name: CI on: push: jobs: build: runs-on: ubuntu-latest container: ubuntu:bionic steps: - run: | apt-get update -qqy apt-get install -qqy git - uses: actions/checkout@v2 - run: git status
最後の git status
が失敗します。
actions/checkout@v2 は Git 2.18 以上を要求している。しかし...
これの答えは actions/checkout@v2
のログに書かれています。
The repository will be downloaded using the GitHub REST API To create a local Git repository instead, add Git 2.18 or higher to the PATH
Git 2.18
以上がインストールされていないと git clone
ではなくGitHub REST APIを使ってダウンロードしてくるのですね。
しかし、Ubuntu BionicにインストールされるGitのバージョンは
残念ながら1ポイント及ばす 2.17
なのです(2021年3月17日)
actions/checkout@v2 on Ubuntu Bionicでgit cloneしてもらうにはGitのバージョンをあげるしかない
ということで、私は以下のようにしています。
name: CI on: push: jobs: build: runs-on: ubuntu-latest container: ubuntu:bionic steps: - name: Update Git run: | apt-get update -qqy apt-get -qqy install software-properties-common add-apt-repository -y ppa:git-core/ppa apt-get update -qqy apt-get -qqy install git - uses: actions/checkout@v2 - run: git status
add-apt-repository
を使いたいのでsoftware-properties-common
をインストール- “Ubuntu Git Maintainers” teamのPPAをリポジトリとして追加
- Gitをインストール
無事 git clone
されました。
以上、メモでした。