TIL 230130 - GitHub Actions checkout fetch-depth 옵션

amoseui·2023년 1월 30일
0

Today I Learned

목록 보기
4/5

상황

GitHub Actions 에서 checkout 한 repo 에 대하여 git log $DIR 과 같이 서브 폴더에 대한 git log 를 확인하는 경우

문제점

  • 특정 폴더나 파일의 git log 를 확인하여도 마지막 commit 정보만 나옴.
  • Actions 에서 최신 commit 값만 확인하려고 했기 때문에 commit 이 1개만 나온다는 걸 인지하지 못함
  • checkout 의 fetch-depth 옵션의 Default 값은 1 로 1개의 commit 에 대한 히스토리만 받아오고 있음

해결

fetch-depth 옵션을 0 으로 선언하여 전체 히스토리를 받아오게 해야 한다.

https://github.com/actions/checkout

- uses: actions/checkout@v3
  with:
  	# Number of commits to fetch. 0 indicates all history for all branches and tags.
    # Default: 1
    fetch-depth: 0

0개의 댓글