Conversation
📝 WalkthroughWalkthroughGitHub Actions 워크플로우 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant GH as GitHub Actions
participant Chrom as Chromatic
participant Slack as Slack
Dev->>GH: Trigger workflow (pull_request or workflow_dispatch)
GH->>Chrom: Run Chromatic deployment
Chrom-->>GH: Deployment result (URL)
alt Event == pull_request
GH->>GH: if: event_name == 'pull_request'
GH->>GH: Add Storybook URL Comment (on PR)
else Event != pull_request
GH->>GH: Skip PR comment step
end
GH->>Slack: Send notification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (6)
.github/workflows/chromatic-CD.yml (6)
61-79: Slack 성공 알림의 PR URL 참조는 비‑PR 이벤트에서 빈 값이 될 수 있음
workflow_dispatch에서도 이 스텝은 실행되지만github.event.pull_request.html_url은 비어 있을 수 있습니다. 실패를 유발하진 않더라도 메시지 품질 저하가 있습니다. 아래 둘 중 한 가지로 정리 제안:
- Option A: PR 이벤트에서만 전송
- Option B: 비‑PR에선 Run URL/커밋 링크로 대체
예시 (Option B):
- - name: Send Slack Success Notification - if: success() + - name: Send Slack Success Notification + if: success() uses: slackapi/slack-github-action@v1.26.0 with: payload: | { "blocks": [ { "type": "section", "text": { "type": "mrkdwn", - "text": "✨ **Storybook 배포가 완료되었습니다!** \n\n🔍 PR: ${{ github.event.pull_request.html_url }}\n📚 Storybook: ${{ steps.chromatic.outputs.storybookUrl }}\n\n💬 피드백 부탁드립니다!" + "text": "✨ **Storybook 배포가 완료되었습니다!** \n\n🔍 Context: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}\n📚 Storybook: ${{ steps.chromatic.outputs.storybookUrl }}\n\n💬 피드백 부탁드립니다!" } } ] }수동 실행 시 Slack 메시지에 올바른 링크가 나오는지 확인 부탁드립니다.
81-99: Slack 실패 알림도 동일한 PR URL 빈 값 이슈 가능성공 알림과 동일한 방식으로 가드/대체 링크 적용을 권장합니다. 최소 변경이라면 PR 이벤트로 한정:
- - name: Send Slack Failure Notification - if: failure() + - name: Send Slack Failure Notification + if: failure() && github.event_name == 'pull_request'
46-49: Chromatic 액션@latest는 재현성을 해칩니다 — 버전/SHA 고정 권장빌드 환경 재현성과 공급망 안전을 위해
chromaui/action@<semver>또는 커밋 SHA로 고정하세요. 동일하게actions/checkout,actions/setup-node,pnpm/action-setup,slackapi/slack-github-action도 고정 권장.Dependabot으로 GitHub Actions 업데이트 자동화도 고려해 주세요.
3-6: 권한 범위 최소화워크플로우 전역
permissions대신 잡 단위로 이동해 범위를 축소하는 것을 권장합니다. (이 워크플로우는 단일 잡이므로 동작은 동일하나, 향후 잡 추가 시 사고 범위를 줄일 수 있습니다.)
10-18: 트리거 타입 보강(선택)PR이 다시 열리거나(draft → ready_for_review) 갱신될 때도 댓글/알림이 필요하면
types에reopened,ready_for_review추가를 고려하세요.
19-23: 중복 실행 취소를 위한 concurrency 설정 제안(선택)푸시가 연달아 들어오는 PR에서 이전 실행을 취소하면 Chromatic 사용량/알림 노이즈를 줄일 수 있습니다.
예시:
concurrency: group: chromatic-${{ github.ref }} cancel-in-progress: true
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/chromatic-CD.yml(1 hunks)
🔇 Additional comments (1)
.github/workflows/chromatic-CD.yml (1)
51-54: PR 이벤트에서만 PR 댓글 작성하도록 가드 추가 — 문제 재발 방지에 적합
workflow_dispatch에서 실패하던 코멘트 액션을 안전하게 건너뜁니다. 수동 트리거로 한 번 실행해 실제로 에러가 사라졌는지 확인만 부탁드립니다.
|
|
||
| - name: Add Storybook URL Comment | ||
| if: ${{ github.event_name == 'pull_request' }} | ||
| uses: thollander/actions-comment-pull-request@v1 |
There was a problem hiding this comment.
🛠️ Refactor suggestion
🧩 Analysis chain
액션 버전 고정 및 최신 메이저 확인 권장
thollander/actions-comment-pull-request@v1은 오래되었을 수 있습니다. 공급망/재현성 측면에서 메이저 최신 또는 커밋 SHA로 고정을 권장합니다. 또한 comment-tag 옵션으로 “덮어쓰기(업데이트)”를 사용하면 코멘트 중복을 방지할 수 있습니다.
예시:
- uses: thollander/actions-comment-pull-request@v1
+ uses: thollander/actions-comment-pull-request@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
📚 Storybook is ready for review!
🔗 Preview: ${{ steps.chromatic.outputs.storybookUrl }}
+ comment-tag: chromatic-preview
+ allow-repeats: false🌐 Web query:
thollander/actions-comment-pull-request의 최신 메이저 버전과 SHA 고정 가이드가 무엇인지?
💡 Result:
요약:
- 최신 메이저 버전: v3 (최신 릴리스 v3.0.1 — 2024‑11‑02). [1][2]
- SHA 고정 가이드: 보안상 액션은 전체 길이(commit SHA)로 고정(pin)해야 함 — workflow의 uses 필드에 커밋 SHA를 사용(예: uses: thollander/actions-comment-pull-request@)하고 원래 태그/버전은 주석으로 남기는 것을 권장. 자세한 권고와 예시는 GitHub 문서 참조. [3][1]
참고자료:
- thollander/actions-comment-pull-request README (사용 예시: thollander/actions-comment-pull-request@v3). [1]
- Releases (최신: v3.0.1, 태그 및 릴리스 노트). [2]
- GitHub 보안 권고 — 액션을 전체 길이 커밋 SHA로 고정할 것(권장 이유 및 예시). [3]
thollander/actions-comment-pull-request을 v3로 업데이트하고 커밋 SHA로 고정하세요
- 파일: .github/workflows/chromatic-CD.yml (line 53) — 현재: uses: thollander/actions-comment-pull-request@v1. 최신 메이저는 v3 (최신 릴리스 v3.0.1 — 2024-11-02). 보안상 전체 커밋 SHA로 핀하는 것을 권장: uses: thollander/actions-comment-pull-request@ (태그/버전은 주석으로 보관).
- 중복 코멘트 방지: with: 아래에 comment-tag: chromatic-preview 및 allow-repeats: false 추가.
🤖 Prompt for AI Agents
.github/workflows/chromatic-CD.yml around line 53: the action reference uses
thollander/actions-comment-pull-request@v1; update it to the v3 release and pin
to the exact commit SHA (replace the @v1 ref with @<full-commit-sha>) while
preserving the human-readable tag/version as a comment; additionally, under the
action's with: block add comment-tag: chromatic-preview and allow-repeats: false
to prevent duplicate comments.
widse
left a comment
There was a problem hiding this comment.
@seungdeok
하나의 pr에서 ui 수정으로 인해 commit push로 ui 수정이 일어났을때 새로 갱신된 chromatic url 이 추가가 되어야할거 같은데 이렇게 변경해도 문제가 없는지 확인 필요할거 같아요
📝 PR 설명
Chromatic CD가 pull_request에서만 comment를 추가하도록 workflow를 개선하였습니다.
관련된 이슈 넘버
close #74
✅ 작업 목록
📚 논의사항
📚 ETC
Summary by CodeRabbit