Skip to content

fix(ci): changepacks 가 base branch 로컬 ref 를 찾지 못해 실패하는 문제 - #204

Merged
owjs3901 merged 1 commit into
mainfrom
owjs3901/ci-changepacks-base-ref
Sep 19, 2026
Merged

owjs3901 merged 1 commit into
mainfrom
owjs3901/ci-changepacks-base-ref

Conversation

@owjs3901

Copy link
Copy Markdown
Contributor

문제

changepacks 잡이 실패합니다.

##[error]changepacks check failed: Error: base branch 'main' not found in local refs:
The reference 'refs/heads/main' did not exist

main 에서 이미 실패하고 있던 버그입니다. #171 이나 #167 과 무관합니다.

run 커밋 changepacks
35083255058 (main push, 2026-09-16) #200 머지 ❌ failure (동일 에러)
35453147912 (#171) 27b257d ❌ failure (동일 에러)

#167 이 go-test 를 changepacks 의 needs 에 넣은 뒤로 go-test 가 계속 깨져 있어서, 그 사이 PR 들에서는 changepacks 가 아예 실행되지 못해 드러나지 않았습니다. #202 · #203 으로 go-test 가 복구되자 다시 보이기 시작했습니다.

원인

actions/checkout 이 실제로 실행하는 명령은 이렇습니다.

git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules origin \
  +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
git checkout --progress --force 27b257db60c260e5b47804018f8a75da7964634d
  • fetch-depth: 0 이라 이력은 전부 받지만, 브랜치는 refs/remotes/origin/* 로만 들어옵니다.
  • ref: 에 SHA 를 주므로 detached HEAD 가 됩니다. 따라서 refs/heads/main 은 만들어지지 않습니다.
  • changepacks/action 은 base branch 를 로컬 ref (refs/heads/<name>) 에서 찾습니다.

ref: 에 SHA 를 주는 것은 fork PR 의 코드를 점검하기 위해 필요하므로 그대로 두고, 로컬 ref 만 세워 줍니다.

수정

checkout 다음에 한 스텝을 추가합니다.

- name: Materialize the base branch as a local ref
  env:
    BASE: ${{ github.event.pull_request.base.ref || github.ref_name }}
  run: git branch --force "$BASE" "refs/remotes/origin/$BASE"
  • pull_request_target 이면 github.event.pull_request.base.ref, push 면 github.ref_name — 둘 다 main 입니다.
  • 이미 fetch-depth: 0 으로 전부 받아둔 뒤라 추가 네트워크 비용이 없습니다.
  • 값은 env 로 넘겨 스크립트에 식이 직접 전개되지 않게 했습니다.
  • HEAD 가 detached 라서 git branch --force 가 체크아웃된 브랜치와 충돌하지 않습니다.

@owjs3901
owjs3901 merged commit a5e6bb2 into main Sep 19, 2026
27 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant