-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from boostcampwm-2024/feature/github-action
github action 스크립트 설정
- Loading branch information
Showing
5 changed files
with
91 additions
and
59 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @paulcjy @SeoGeonhyuk @Gdm0714 @p1n9d3v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
PR 작성 전 체크 리스트 | ||
타이틀은 “이번 작업을 한 문장의 메시지로 요약한 것”으로 설정합니다. | ||
|
||
완료 작업 목록을 기록합니다. (WHAT) | ||
|
||
커밋이 작게 쪼개져 있기 때문에 맥락을 알 수 있도록 어떤 작업을 완료했는지 드러나야 합니다. | ||
완료하지 않은 것은 반드시 제외합니다. 동작 화면이 있다면 스크린 캡처를 포함합니다. | ||
고민과 해결 과정을 기록합니다. (HOW+WHY) | ||
|
||
어떤 문제를 해결하려고 무엇을 시도했는지, 결과적으로 어떻게 해결했는지 포함합니다. | ||
|
||
PR 작성 후 충돌이 안 나는지 확인할 것 | ||
|
||
<위 내용은 모두 삭제하고 PR 보내세요> | ||
|
||
---- 절취선 ---- | ||
|
||
주요 작업 | ||
구현 결과 | ||
비고(Optional) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.