Repository navigation
[ci/cd] PR 머지 후 head 브랜치 자동 삭제 워크플로 추가 - #293
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
yeondon125
approved these changes
Nov 9, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요 💡
저장소 설정
deleteBranchOnMerge가 꺼져 있어 머지된 브랜치를 직접 지워야 했고, 원격에 머지된 브랜치가 계속 쌓이고 있었습니다. PR이 머지되면 head 브랜치를 자동으로 삭제하는GitHub Actions워크플로를 추가하였습니다.저장소 설정을 켜는 방법은
develop→main머지 때develop이 삭제 대상이 되고, 제외 규칙을 둘 수 없어 워크플로로 처리하였습니다.작업내용 ⌨️
.github/workflows/delete-merged-branch.yml을 추가하였습니다.pull_request의closed이벤트에서 머지된 PR이면서 같은 저장소에서 올라온 브랜치일 때만 실행되도록 하였습니다. fork 브랜치는 삭제 권한이 없어 제외하였습니다.main,develop과,main·develop양쪽에 머지해야 하는release/*,hotfix/*는 삭제하지 않도록 하였습니다.bash -e)에는pipefail이 없어 조회 결과를 파이프로 넘기면 실패가 묻히므로, 조회와 필터링을 나누었습니다.Reference does not exist)는 성공으로 처리하고, 그 외 삭제 실패는 job을 실패로 처리하였습니다.contents: write,pull-requests: read만 부여하였습니다.gh를 가짜 스크립트로 바꿔bash -e환경에서 제외 브랜치, 일반 브랜치, 쌓인 PR, 같은 head의 다른 PR, 이미 삭제됨, 권한 오류, 목록 조회 실패 경우를 확인하였습니다. 실제GitHub Actions환경에서는 아직 실행해 보지 않았습니다.관련 이슈 🚨
리뷰 요청사항 👀
chore/auto-delete-merged-branch)가 첫 실행 대상이 될 것으로 예상합니다. 머지 후 Actions 실행 결과와 브랜치 삭제 여부를 확인해 주세요.main,develop,release/*,hotfix/*)에 더 추가할 브랜치가 있는지 확인해 주세요.