Skip to content

Commit

Permalink
Merge pull request #84 from boostcampwm-2024/feature/github-action
Browse files Browse the repository at this point in the history
github action 스크립트 설정
  • Loading branch information
SeoGeonhyuk authored Nov 19, 2024
2 parents 764da59 + 25e0dd5 commit 46fd302
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 59 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @paulcjy @SeoGeonhyuk @Gdm0714 @p1n9d3v
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PR 작성 전 체크 리스트
타이틀은 “이번 작업을 한 문장의 메시지로 요약한 것”으로 설정합니다.

완료 작업 목록을 기록합니다. (WHAT)

커밋이 작게 쪼개져 있기 때문에 맥락을 알 수 있도록 어떤 작업을 완료했는지 드러나야 합니다.
완료하지 않은 것은 반드시 제외합니다. 동작 화면이 있다면 스크린 캡처를 포함합니다.
고민과 해결 과정을 기록합니다. (HOW+WHY)

어떤 문제를 해결하려고 무엇을 시도했는지, 결과적으로 어떻게 해결했는지 포함합니다.

PR 작성 후 충돌이 안 나는지 확인할 것

<위 내용은 모두 삭제하고 PR 보내세요>

---- 절취선 ----

주요 작업
구현 결과
비고(Optional)
60 changes: 60 additions & 0 deletions .github/workflows/check-open-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Check Open PRs and Notify Slack

on:
schedule:
# 매 1분마다 실행
- cron: '1 * * * *'

workflow_dispatch: # 수동 실행을 위한 트리거
inputs:
force_notify:
description: "Force Slack notification"

jobs:
notify_open_prs:
runs-on: ubuntu-latest

steps:
# 1. GitHub 리포지토리 체크아웃
- name: Checkout repository
uses: actions/checkout@v3

# 2. PR 데이터 수집
- name: Fetch Open PRs with Reviewers
id: fetch_prs
run: |
# 모든 열린 PR 가져오기
prs=$(gh pr list --json number,title,url,reviewRequests --jq '.[] | select(.reviewRequests | length > 0)')
echo "Found PRs: $prs"
# JSON 데이터를 Action output으로 저장
echo "::set-output name=prs::$prs"
env:
GITHUB_TOKEN: ${{ secrets.G_TOKEN }} # GitHub 기본 제공 토큰

# 3. Slack 알림 전송
- name: Notify Slack
if: steps.fetch_prs.outputs.prs != '' # 열린 PR이 있을 때만 실행
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # Slack 웹훅 URL
run: |
echo "Preparing Slack notification..."
prs_json='${{ steps.fetch_prs.outputs.prs }}'
if [ -z "$prs_json" ]; then
echo "No PRs to notify about."
exit 0
fi
# Slack 메시지 작성
message=":warning: *Open Pull Requests with Reviewers:*"
echo $prs_json | jq -c '.[]' | while read -r pr; do
title=$(echo $pr | jq -r '.title')
url=$(echo $pr | jq -r '.url')
reviewers=$(echo $pr | jq -r '.reviewRequests | map(.login) | join(", ")')
message+="\n- <$url|$title> (Reviewers: $reviewers)"
done
# Slack 메시지 전송
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"$message\"}" $SLACK_WEBHOOK_URL
2 changes: 1 addition & 1 deletion apps/client/src/cloud-graph/components/Connector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTheme } from '@mui/material';
import { Point } from '@cloudflow/types';
import { Point } from '@cloud-graph/types';

type Props = {
from: Point;
Expand Down
67 changes: 9 additions & 58 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 46fd302

Please sign in to comment.