GitHub Actions 에서 Versioning/Changelogs 제대로 안될때

HYUNGU, KANG·2023년 6월 23일
1
post-thumbnail

깃허브 액션에서 lerna 혹은 다른 툴들을 사용하여 버저닝(versioning) 이나 체인지로그(changelogs) 를 추출할 때 정상적으로 추출을 못하는 경우가 있다.

이는 액션에서 소스코드를 받아오는 actions/checkout 때문인데, 코드를 빠르게 받아오기 위해서 기본적으로 워크플로우를 트리거한 ref/SHA 를 기준으로 싱글 커밋만을 가져오기 때문이다.

actions/checkout 의 README 를 보면 다음과 같은 문구가 적혀있다.

Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. Set fetch-depth: 0 to fetch all history for all branches and tags. Refer here to learn which commit $GITHUB_SHA points to for different events.

이때문에 버저닝이나 체인지로그를 추출하는데 필요한 커밋 히스토리, 브랜치, 태그 등의 정보들이 없기 때문에 정상적으로 동작하지 않는다.

이를 해결하기 위해서는 fetch-depth: 0 옵션을 액션에 주면 된다.

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
profile
JavaScript, TypeScript and React-Native

0개의 댓글