-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] merge, create PR 로직 분리 #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Create & Merge Bump PR | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - 'bump/*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| create-pr: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Create PR | ||
| id: cpr | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const branch = context.ref.replace('refs/heads/', ''); | ||
|
|
||
| const pr = await github.rest.pulls.create({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| title: 'chore: bump version & sync exports', | ||
| head: branch, | ||
| base: 'main' | ||
| }); | ||
|
|
||
| core.setOutput('pr_number', pr.data.number); | ||
|
|
||
| - name: Auto-merge PR | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.pulls.merge({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: ${{ steps.cpr.outputs.pr_number }} | ||
| }); | ||
|
Comment on lines
+33
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR merge 실패 시 npm publish 진행 방지가 필요합니다. 라인 33-41의 auto-merge 스텝이 실패해도 (예: 충돌 발생) 라인 57의 제안:
- name: Checkout merged main
if: success()
uses: actions/checkout@v4
with:
ref: main
- name: Publish to npm
if: success()
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}🤖 Prompt for AI Agents |
||
|
|
||
| - name: Checkout merged main | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Publish to npm | ||
| run: npm publish | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
Comment on lines
+1
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial 두 워크플로우 간 타이밍 문제 및 race condition 가능성을 검토하세요.
제안: concurrency:
group: bump-and-publish
cancel-in-progress: false🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR 생성 실패 시 다음 단계 진행 방지 필요합니다.
라인 31에서
pr_number를 출력한 후, 라인 33의 auto-merge 스텝이 무조건 실행됩니다. PR 생성이 실패해도 워크플로우는 계속 진행되어 존재하지 않는 PR 번호로 merge 요청을 시도하게 됩니다.제안:
if: success()조건을 auto-merge 스텝에 추가하거나, 스크립트에 명시적 에러 처리를 추가하세요.🤖 Prompt for AI Agents