Skip to content
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

[24.12.22 / TASK-67] Feature - 메인 배치 기본 깃액션 추가 #9

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

Nuung
Copy link
Member

@Nuung Nuung commented Dec 22, 2024

  • 추가되는 코드보다 노션 내용이 더 중요함!

Summary by CodeRabbit

  • 새로운 기능
    • Velog 게시물을 자동으로 스크랩하는 새로운 GitHub Actions 워크플로우 추가.
    • 성공 및 실패 시 Slack 알림 기능 포함.
  • 변경 사항
    • CI 워크플로우의 캐싱 액션을 actions/cache@v4로 업그레이드.

@Nuung Nuung added the enhancement New feature or request label Dec 22, 2024
@Nuung Nuung self-assigned this Dec 22, 2024
Copy link

Copy link

coderabbitai bot commented Dec 22, 2024

Caution

Review failed

The pull request is closed.

워크스루

GitHub Actions 워크플로우 파일 run-daily-aggre.yaml이 추가되었습니다. 이 워크플로우는 Velog 게시물을 수동으로 또는 잠재적으로 30분마다 스크래핑하도록 설계되었습니다. Ubuntu 환경에서 실행되며, Python 3.13.0과 Poetry를 사용하여 프로젝트 종속성을 관리하고 Velog 스크래핑 스크립트를 실행합니다. 또한, CI 워크플로우의 캐싱 액션이 업데이트되었습니다.

변경 사항

파일 변경 요약
.github/workflows/run-daily-aggre.yaml GitHub Actions 워크플로우 추가, Velog 게시물 스크래핑 자동화
.github/workflows/test-ci.yaml 캐싱 액션을 actions/cache@v3에서 actions/cache@v4로 업데이트

시퀀스 다이어그램

sequenceDiagram
    participant GA as GitHub Actions
    participant Py as Python Script
    participant Velog as Velog Platform
    participant Slack as Slack Notification

    GA->>Py: Trigger scraping script
    Py->>Velog: Fetch posts
    Velog-->>Py: Return post data
    alt Scraping Successful
        Py->>Slack: Send success notification
    else Scraping Failed
        Py->>Slack: Send failure notification
    end
Loading

관련 PR

제안된 리뷰어

  • BDlhj
  • HA0N1
  • six-standard

시 🐰

🤖 스크래핑 토끼, 데이터를 달리다
Velog의 글을 재빠르게 모으네
GitHub Actions의 마법으로
자동화의 춤을 추네
성공과 실패, Slack에 알리며 🚀


📜 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 d8cac7b and 9105b9c.

📒 Files selected for processing (2)
  • .github/workflows/run-daily-aggre.yaml (1 hunks)
  • .github/workflows/test-ci.yaml (1 hunks)

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: 4

🧹 Nitpick comments (2)
.github/workflows/run-daily-aggre.yaml (2)

41-61: 환경 변수 설정 최적화 필요

환경 변수 설정이 개별적으로 이루어져 있어 비효율적입니다. 하나의 here-document를 사용하여 더 효율적으로 작성할 수 있습니다.

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

      - name: Create .env file
        run: |
-         echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> .env
-         echo "DEBUG=False" >> .env
-         # ... (other echo commands)
+         cat << EOF > .env
+         SECRET_KEY=${{ secrets.SECRET_KEY }}
+         DEBUG=False
+         DATABASE_ENGINE=${{ secrets.DATABASE_ENGINE }}
+         DATABASE_NAME=${{ secrets.DATABASE_NAME }}
+         POSTGRES_USER=${{ secrets.POSTGRES_USER }}
+         POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}
+         POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}
+         POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}
+         AES_KEY_0=${{ secrets.AES_KEY_0 }}
+         AES_KEY_1=${{ secrets.AES_KEY_1 }}
+         AES_KEY_2=${{ secrets.AES_KEY_2 }}
+         AES_KEY_3=${{ secrets.AES_KEY_3 }}
+         AES_KEY_4=${{ secrets.AES_KEY_4 }}
+         AES_KEY_5=${{ secrets.AES_KEY_5 }}
+         AES_KEY_6=${{ secrets.AES_KEY_6 }}
+         AES_KEY_7=${{ secrets.AES_KEY_7 }}
+         AES_KEY_8=${{ secrets.AES_KEY_8 }}
+         AES_KEY_9=${{ secrets.AES_KEY_9 }}
+         EOF
🧰 Tools
🪛 actionlint (1.7.4)

42-42: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


67-105: Slack 알림 로직 개선 필요

Slack 알림 설정에 중복 코드가 있으며, 액션 버전이 최신이 아닙니다.

  1. Slack 액션 버전을 업데이트하고,
  2. 공통 로직을 환경 변수로 추출하여 중복을 제거하는 것을 제안합니다:
+     - name: Set common notification variables
+       run: |
+         echo "WORKFLOW_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
+         echo "TIMESTAMP=<!date^${{ github.event.repository.updated_at }}^{date_short_pretty} {time}|Timestamp>" >> $GITHUB_ENV

      - name: Send Slack Notification on Success
        if: success()
-       uses: slackapi/[email protected]
+       uses: slackapi/[email protected]
        with:
          payload: |
            {
              "text": "✅ Velog Dashboard Daily Stats Batch Successful",
              "blocks": [
                {
                  "type": "section",
                  "text": {
                    "type": "mrkdwn",
-                   "text": "*Velog Dashboard Daily Stats Batch*\n\n✅ *Status:* Success\n📅 *Timestamp:* <!date^${{ github.event.repository.updated_at }}^{date_short_pretty} {time}|Timestamp>\n🔗 *Workflow URL:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
+                   "text": "*Velog Dashboard Daily Stats Batch*\n\n✅ *Status:* Success\n📅 *Timestamp:* ${{ env.TIMESTAMP }}\n🔗 *Workflow URL:* ${{ env.WORKFLOW_URL }}"
                  }
                }
              ]
            }

실패 알림도 동일한 방식으로 수정해주세요.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7a58131 and d8cac7b.

📒 Files selected for processing (1)
  • .github/workflows/run-daily-aggre.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/run-daily-aggre.yaml

18-18: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


33-33: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


42-42: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)

.github/workflows/run-daily-aggre.yaml Outdated Show resolved Hide resolved
.github/workflows/run-daily-aggre.yaml Show resolved Hide resolved
.github/workflows/run-daily-aggre.yaml Show resolved Hide resolved
.github/workflows/run-daily-aggre.yaml Outdated Show resolved Hide resolved
@Nuung Nuung merged commit 656e39e into main Dec 22, 2024
1 of 2 checks passed
@Nuung Nuung deleted the feature/main-batch-git-action branch December 22, 2024 11:33
@HA0N1
Copy link

HA0N1 commented Dec 22, 2024

옹 이런 것도 가능하군요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants