File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,18 @@ jobs:
3636 state: "closed"
3737 });
3838 }
39- }
39+
40+ // 🗑️ 병합된 브랜치 삭제 (main, dev 보호)
41+ const headBranch = pr.head.ref;
42+ const protectedBranches = ['main', 'dev'];
4043
41- - name : Delete merged branch
42- uses : peter-evans/delete-branch@v2
43- with :
44- branch : ${{ github.event.pull_request.head.ref }} # PR source branch
45- token : ${{ secrets.PROJECT_GITHUB_TOKEN }}
46- exclude : main, dev
44+ if (!protectedBranches.includes(headBranch)) {
45+ console.log(`🗑️ Deleting branch: ${headBranch}`);
46+ await github.rest.git.deleteRef({
47+ owner: context.repo.owner,
48+ repo: context.repo.repo,
49+ ref: `heads/${headBranch}`
50+ });
51+ } else {
52+ console.log(`⚠️ Skipping deletion of protected branch: ${headBranch}`);
53+ }
You can’t perform that action at this time.
0 commit comments