Skip to content

Comments

[Deploy] PR preview url 생성 workflows 구축#174

Merged
miraclee1226 merged 10 commits intodevelopfrom
173-deploy-pr-미리보기-url-자동-생성-워크플로우-구축
Jan 1, 2025

Hidden character warning

The head ref may contain hidden characters: "173-deploy-pr-\ubbf8\ub9ac\ubcf4\uae30-url-\uc790\ub3d9-\uc0dd\uc131-\uc6cc\ud06c\ud50c\ub85c\uc6b0-\uad6c\ucd95"
Merged

[Deploy] PR preview url 생성 workflows 구축#174
miraclee1226 merged 10 commits intodevelopfrom
173-deploy-pr-미리보기-url-자동-생성-워크플로우-구축

Conversation

@miraclee1226
Copy link
Collaborator

@miraclee1226 miraclee1226 commented Dec 29, 2024

🚀 작업 내용

  • PR preview url 생성 workflows 구축

📝 참고 사항

  • 쿼리 파라미터를 이용해서 PR number에 따라 Preview Url이 생성되도록 workflows를 생성했습니다.

ex)
Default: https://codeit.kr/?pr=pr번호
어드민 페이지 접속: https://codeit.kr/admin/members?pr=pr번호

🚨 관련 이슈 (이슈 번호)

✅ 체크리스트

  • Code Review 요청
  • Label 설정
  • PR 제목 규칙에 맞는지 확인

Summary by CodeRabbit

  • 새로운 기능
    • 풀 리퀘스트에 대한 미리보기 환경을 자동으로 배포하는 GitHub Actions 워크플로우 추가
    • AWS S3와 CloudFront를 통한 자동 웹사이트 미리보기 기능 구현
    • 풀 리퀘스트에 미리보기 URL을 자동으로 댓글로 추가하는 기능

@coderabbitai
Copy link

coderabbitai bot commented Dec 29, 2024

Walkthrough

새로운 GitHub Actions 워크플로우 preview-url.github/workflows/preview.yml에 추가되었습니다. 이 워크플로우는 develop 브랜치의 풀 리퀘스트에서 트리거되며, 프리뷰 환경을 설정하는 작업을 포함합니다. Node.js 20.x와 pnpm을 사용하여 프로젝트를 빌드하고, AWS S3와 CloudFront를 통해 애플리케이션을 배포하며, 풀 리퀘스트에 프리뷰 URL을 자동으로 댓글로 추가합니다.

Changes

File Change Summary
.github/workflows/preview.yml 새로운 GitHub Actions 워크플로우 추가

Possibly related issues

  • codeit-internship-group-b/codeit-resources#173: PR 미리보기 URL 자동 생성 워크플로우 구축 요청과 정확히 일치하는 이슈

Possibly related PRs

Suggested labels

👽 BE

Suggested reviewers

  • cindycho0423
  • AdamSeungheonShin
  • bokeeeey
  • dudwns0213

Poem

🐰 깃헙 액션의 마법사
프리뷰 URL, 순식간에 생성
S3와 CloudFront의 춤
개발자의 미소를 그리다
토끼의 기술, 신비로운 배포! 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccd7332 and 48b5da6.

📒 Files selected for processing (1)
  • .github/workflows/preview.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/preview.yml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
.github/workflows/preview.yml (2)

7-9: PR 트리거 설정을 더 구체적으로 지정하는 것이 좋습니다.

현재 설정은 모든 PR 이벤트에 대해 실행됩니다. 리소스 효율성을 위해 필요한 이벤트 타입만 지정하는 것이 좋습니다.

다음과 같이 수정하는 것을 제안합니다:

on:
  pull_request:
    branches: [develop]
+   types: [opened, synchronize, reopened]

54-63: PR 코멘트에 추가 정보를 포함하면 좋겠습니다.

현재 코멘트는 기본적인 정보만 포함하고 있습니다. 배포 시간과 환경 정보를 추가하면 더 유용할 것 같습니다.

다음과 같이 수정하는 것을 제안합니다:

  message: |
    ## 🚀 Preview URL

    **Branch:** ${{ github.head_ref }}
    **Commit:** ${{ github.sha }}
+   **배포 시간:** $(date '+%Y-%m-%d %H:%M:%S')
+   **Node 버전:** ${{ matrix.node-version }}

    Preview URL: https://codeit.click?pr=${{ github.event.pull_request.number }}
+   
+   > 이 프리뷰는 자동으로 생성되었으며, PR이 머지되면 자동으로 제거됩니다.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24d0f56 and 45ab8e1.

📒 Files selected for processing (1)
  • .github/workflows/preview.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/preview.yml

42-42: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (1)
.github/workflows/preview.yml (1)

15-30: 개발 환경 설정이 잘 구성되어 있습니다.

Node.js와 pnpm 설정이 적절하게 구성되어 있으며, 캐싱도 잘 적용되어 있습니다.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/preview.yml (2)

48-50: S3 배포 단계에 오류 처리를 추가해야 합니다.

S3 동기화 실패 시 워크플로우가 적절히 실패하도록 오류 처리를 추가하는 것이 좋습니다.

다음과 같이 수정하는 것을 제안합니다:

- run: aws s3 sync ./${{ secrets.BUILD_DIRECTORY }} s3://${{ secrets.AWS_S3_BUCKET_NAME }}/pr-${{ github.event.pull_request.number }} --delete
+ run: |
+   if ! aws s3 sync ./${{ secrets.BUILD_DIRECTORY }} s3://${{ secrets.AWS_S3_BUCKET_NAME }}/pr-${{ github.event.pull_request.number }} --delete; then
+     echo "S3 동기화 중 오류가 발생했습니다"
+     exit 1
+   fi

54-63: PR 코멘트에 추가 정보를 포함하면 좋겠습니다.

미리보기 URL과 함께 배포 시간과 만료 예정 시간을 포함하면 사용자에게 더 유용할 것 같습니다.

다음과 같이 수정하는 것을 제안합니다:

  message: |
    ## 🚀 Preview URL

    **Branch:** ${{ github.head_ref }}
    **Commit:** ${{ github.sha }}
+   **배포 시간:** ${{ steps.current-time.outputs.time }}
+   **만료 예정:** 다음 PR 배포 시

    Preview URL: https://codeit.click?pr=${{ github.event.pull_request.number }}

시간 출력을 위해 이전 단계로 다음을 추가해야 합니다:

- name: Get current time
  id: current-time
  run: echo "time=$(date +'%Y-%m-%d %H:%M:%S %Z')" >> $GITHUB_OUTPUT
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45ab8e1 and 740e6e5.

📒 Files selected for processing (1)
  • .github/workflows/preview.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/preview.yml

42-42: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (5)
.github/workflows/preview.yml (5)

1-10: 워크플로우 권한 및 트리거 설정이 적절합니다.

PR 미리보기 URL 생성을 위한 권한과 트리거가 올바르게 구성되어 있습니다.


18-31: Node.js 및 pnpm 설정이 최적화되어 있습니다.

캐싱을 활용하고 --frozen-lockfile을 사용하여 의존성 설치를 안전하게 수행하고 있습니다.


32-37: 환경 변수 유효성 검사가 필요합니다.

환경 변수가 올바르게 설정되었는지 확인하는 검증 단계를 추가해야 합니다.

다음과 같이 수정하는 것을 제안합니다:

  - name: Generate Environment Variables File
    run: |
+     if [ -z "$NEXT_PUBLIC_API_URL" ]; then
+       echo "Error: NEXT_PUBLIC_API_URL이 설정되지 않았습니다"
+       exit 1
+     fi
      echo "NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL" >> apps/web/.env.production.local
    env:
      NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}

41-47: AWS Credentials 액션 버전 업데이트가 필요합니다.

현재 사용 중인 aws-actions/configure-aws-credentials@v1은 더 이상 권장되지 않습니다.

다음과 같이 수정하는 것을 제안합니다:

- uses: aws-actions/configure-aws-credentials@v1
+ uses: aws-actions/configure-aws-credentials@v4
🧰 Tools
🪛 actionlint (1.7.4)

42-42: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


51-52: CloudFront 캐시 무효화 범위를 최적화해야 합니다.

현재 모든 경로('/*')에 대해 캐시 무효화를 수행하고 있습니다. PR 관련 경로만 무효화하는 것이 효율적입니다.

다음과 같이 수정하는 것을 제안합니다:

- run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths '/*'
+ run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths '/pr-${{ github.event.pull_request.number }}/*'

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/preview.yml (2)

18-31: 의존성 설치 단계의 캐싱 전략을 개선할 수 있습니다.

현재는 Node 모듈에 대한 기본 캐싱만 설정되어 있습니다. 빌드 성능을 향상시키기 위해 다음 사항들을 고려해보세요:

  1. pnpm store 디렉토리 캐싱
  2. Next.js 빌드 캐시 활용
  - name: Install pnpm
    uses: pnpm/action-setup@v4
    with:
      version: 8.15.6
+     run_install: false

  - name: Use Node.js
    uses: actions/setup-node@v4
    with:
      node-version: "20.x"
      cache: "pnpm"

+ - name: Get pnpm store directory
+   id: pnpm-cache
+   run: |
+     echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

+ - name: Setup pnpm cache
+   uses: actions/cache@v3
+   with:
+     path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
+     key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
+     restore-keys: |
+       ${{ runner.os }}-pnpm-store-

  - name: Install dependencies
    run: pnpm install --frozen-lockfile

54-63: 프리뷰 URL 메시지를 개선할 수 있습니다.

프리뷰 URL 메시지에 다음 정보를 추가하면 더 유용할 것 같습니다:

  1. 배포 시간
  2. 만료 예정 시간 (있는 경우)
  3. 관리자 페이지 프리뷰 URL
  message: |
    ## 🚀 Preview URL

    **Branch:** ${{ github.head_ref }}
    **Commit:** ${{ github.sha }}
+   **배포 시간:** ${{ steps.date.outputs.date }}
+   **만료 예정:** 다음 PR 배포 시
    
    프리뷰 URL:
    - 메인: https://codeit.click?pr=${{ github.event.pull_request.number }}
+   - 관리자: https://codeit.click/admin/members?pr=${{ github.event.pull_request.number }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 740e6e5 and c8341a6.

📒 Files selected for processing (2)
  • .github/workflows/preview.yml (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/preview.yml

42-42: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (5)
.github/workflows/preview.yml (5)

1-10: 워크플로우 구성이 적절합니다.

권한 설정과 트리거 조건이 PR 프리뷰 URL 생성 목적에 맞게 잘 구성되어 있습니다.


32-39: 환경 변수 검증 로직이 여전히 필요합니다.

이전 리뷰에서 지적된 환경 변수 검증 로직이 아직 구현되지 않았습니다.


41-46: AWS Credentials 액션 버전 업데이트가 여전히 필요합니다.

이전 리뷰에서 지적된 aws-actions/configure-aws-credentials 액션 버전 업데이트가 아직 적용되지 않았습니다.

🧰 Tools
🪛 actionlint (1.7.4)

42-42: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


51-52: CloudFront 캐시 무효화 범위가 여전히 최적화되지 않았습니다.

이전 리뷰에서 지적된 CloudFront 캐시 무효화 범위 최적화가 아직 적용되지 않았습니다.


48-50: S3 배포 경로에 대한 보안 고려사항이 필요합니다.

PR 번호를 기반으로 한 S3 경로 설정은 적절하나, 다음 보안 고려사항을 추가하는 것이 좋습니다:

  1. PR 번호의 유효성 검증
  2. 배포 디렉토리 경로 주입 공격 방지
✅ Verification successful

Let me check the workflow file content to better understand the context and validation requirements.


GitHub Actions 워크플로우의 보안 검증이 이미 충분합니다.

GitHub Actions의 기본 보안 기능과 워크플로우 구성이 제기된 보안 우려사항을 이미 적절히 다루고 있습니다:

  • PR 번호는 GitHub Actions에서 자동으로 생성되는 시스템 변수(github.event.pull_request.number)로, GitHub에 의해 자동으로 검증됩니다.
  • BUILD_DIRECTORY는 GitHub Secrets로 관리되어 안전하게 보호되며, GitHub Actions의 실행 컨텍스트 내에서만 접근 가능합니다.
  • AWS 자격 증명도 GitHub Secrets를 통해 안전하게 관리되고 있습니다.

추가적인 검증 로직은 불필요하며, 현재 구성이 보안 모범 사례를 잘 따르고 있습니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# PR 번호가 숫자인지 확인
if ! [[ ${{ github.event.pull_request.number }} =~ ^[0-9]+$ ]]; then
  echo "Error: Invalid PR number"
  exit 1
fi

# BUILD_DIRECTORY가 상위 디렉토리를 참조하지 않는지 확인
if [[ "${{ secrets.BUILD_DIRECTORY }}" == *".."* ]]; then
  echo "Error: Invalid build directory path"
  exit 1
fi

Length of output: 248


Script:

#!/bin/bash
# Check the workflow file content
cat .github/workflows/preview.yml

Length of output: 1882

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
.github/workflows/preview.yml (2)

32-37: 🛠️ Refactor suggestion

환경 변수 유효성 검사가 필요합니다.

환경 변수가 올바르게 설정되었는지 확인하는 검증 단계를 추가해야 합니다.

다음과 같이 수정을 제안합니다:

  - name: Generate Environment Variables File
    run: |
+     if [ -z "$NEXT_PUBLIC_API_URL" ]; then
+       echo "Error: NEXT_PUBLIC_API_URL이 설정되지 않았습니다"
+       exit 1
+     fi
      echo "NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL" >> apps/web/.env.production.local
    env:
      NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}

41-47: ⚠️ Potential issue

AWS Credentials 액션 버전 업데이트가 필요합니다.

현재 사용 중인 aws-actions/configure-aws-credentials@v1은 더 이상 권장되지 않습니다.

다음과 같이 수정을 제안합니다:

- uses: aws-actions/configure-aws-credentials@v1
+ uses: aws-actions/configure-aws-credentials@v4
🧰 Tools
🪛 actionlint (1.7.4)

42-42: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🧹 Nitpick comments (1)
.github/workflows/preview.yml (1)

54-63: 프리뷰 URL 코멘트 개선을 제안합니다.

현재 코멘트에 유용한 정보를 추가하면 좋을 것 같습니다.

다음과 같이 수정을 제안합니다:

  message: |
    ## 🚀 Preview URL

    **Branch:** ${{ github.head_ref }}
    **Commit:** ${{ github.sha }}
+   **배포 시간:** `$(date '+%Y-%m-%d %H:%M:%S %Z')`
+   **Admin 페이지:** https://codeit.click/admin/members?pr=${{ github.event.pull_request.number }}

    Preview URL: https://codeit.click?pr=${{ github.event.pull_request.number }}
+
+   > 이 프리뷰는 PR이 머지되거나 클로즈되면 자동으로 제거됩니다.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8341a6 and eabffac.

📒 Files selected for processing (1)
  • .github/workflows/preview.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/preview.yml

42-42: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (4)
.github/workflows/preview.yml (4)

1-10: 워크플로우 권한 설정이 적절합니다.

권한이 최소 권한 원칙에 따라 잘 설정되어 있습니다:

  • pull-requests: write: PR 코멘트를 위해 필요
  • contents: read: 코드 체크아웃을 위해 필요

48-50: 빌드 디렉토리 경로 검증이 필요합니다.

BUILD_DIRECTORY 시크릿이 올바른 경로를 가리키는지 확인해주세요. Next.js 프로젝트의 경우 일반적으로 .next 또는 out 디렉토리를 사용합니다.


51-52: 캐시 무효화 경로가 최적화되어 있습니다.

PR 관련 경로(/pr-{PR_NUMBER}/*)만 무효화하도록 잘 구현되어 있습니다.


18-28: Node.js 버전 호환성 확인이 필요합니다.

Node.js 20.x 버전이 프로젝트의 다른 종속성과 호환되는지 확인해주세요.

✅ Verification successful

Node.js 20.x 버전은 프로젝트의 엔진 요구사항과 호환됩니다.

일부 package.json 파일에서 Node.js >=18 버전을 요구하고 있으며, Node.js 20.x는 이 요구사항을 충족합니다. 다른 package.json 파일들은 Node.js 버전에 대한 제한을 명시하지 않았습니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# package.json에서 Node.js 엔진 요구사항 확인
fd package.json --exec cat {} | jq '.engines.node'

Length of output: 121

@github-actions
Copy link

github-actions bot commented Dec 31, 2024

🚀 Preview URL

Branch: 173-deploy-pr-미리보기-url-자동-생성-워크플로우-구축
Commit: 3a5af6f

Preview URL: https://codeit.click?pr=174

Comment on lines 18 to 21
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우리 기존 8버젼에 맞추는게 좋을거같아

Comment on lines 29 to 33
"prettier": "@org/prettier-config",
"workspaces": [
"packages/*",
"apps/*"
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workspaces는 모노레포 패키지에서 삭제하면 안돼!

package.json Outdated
"typescript": "^5.6.3"
},
"packageManager": "pnpm@8.15.6",
"packageManager": "pnpm@9.12.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packageManager는 기존 버젼 유지하는건 어때?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/preview.yml (1)

38-40: 빌드 실패 시 오류 처리를 개선해주세요.

빌드 단계에 오류 발생 시 더 명확한 피드백을 제공하면 좋을 것 같습니다.

다음과 같이 수정하는 것을 제안합니다:

  - name: Build
    run: |
+     echo "웹 애플리케이션 빌드를 시작합니다..."
      pnpm -filter=web build
+     if [ $? -ne 0 ]; then
+       echo "빌드 실패! 로그를 확인해주세요."
+       exit 1
+     fi
+     echo "빌드가 성공적으로 완료되었습니다."
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7e3ca8 and ccd7332.

📒 Files selected for processing (1)
  • .github/workflows/preview.yml (1 hunks)
🔇 Additional comments (5)
.github/workflows/preview.yml (5)

1-10: 워크플로우 권한 및 트리거 설정이 적절합니다.

필요한 최소 권한만 설정되어 있고, develop 브랜치에 대한 PR에서만 실행되도록 적절히 구성되어 있습니다.


32-37: 환경 변수 유효성 검사가 필요합니다.

환경 변수가 올바르게 설정되었는지 확인하는 검증 로직이 없습니다.

다음과 같이 수정하는 것을 제안합니다:

  - name: Generate Environment Variables File
    run: |
+     if [ -z "$NEXT_PUBLIC_API_URL" ]; then
+       echo "Error: NEXT_PUBLIC_API_URL이 설정되지 않았습니다"
+       exit 1
+     fi
      echo "NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL" >> apps/web/.env.production.local
    env:
      NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}

41-50: AWS 구성이 적절하게 설정되어 있습니다.

최신 버전의 AWS 인증 액션을 사용하고 있으며, PR별로 구분된 S3 경로를 사용하여 안전하게 구성되어 있습니다.


51-53: 캐시 무효화 범위가 최적화되어 있습니다.

이전 리뷰 의견이 반영되어 PR 관련 경로만 무효화하도록 개선되었습니다.


18-31: Node.js 버전 선택을 확인해주세요.

이전 리뷰 코멘트에 따르면 Node.js 8 버전을 사용해야 한다고 언급되어 있으나, 현재 20.x를 사용하도록 설정되어 있습니다. 프로젝트 요구사항과 일치하는지 확인이 필요합니다.

@miraclee1226 miraclee1226 merged commit ab592f7 into develop Jan 1, 2025
1 check passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 27, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌏 Deploy 배포 관련

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Deploy] PR 미리보기 URL 자동 생성 워크플로우 구축

2 participants