Skip to content

Merge pull request #50 from finditem/fix/design-tokens #37

Merge pull request #50 from finditem/fix/design-tokens

Merge pull request #50 from finditem/fix/design-tokens #37

name: Auto Main PR
on:
push:
branches:
- develop
concurrency:
group: develop-to-main-pr
cancel-in-progress: true
jobs:
create-or-update-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create or Update Pull Request
env:
GH_TOKEN: ${{ secrets.YML_GITHUB_TOKEN }}
run: |
git fetch origin main
LOGS=$(git log origin/main..HEAD --merges --pretty=format:"%s" | grep "^Merge pull request" | sed 's/^/- /' || true)
cat << 'EOF' > /tmp/pr_body.md
## 작업 요약
Develop 브랜치의 최신 변경 사항을 Main 브랜치로 반영합니다.
### 최근 머지된 내역
EOF
if [ -n "$LOGS" ]; then
printf '%s\n' "$LOGS" >> /tmp/pr_body.md
else
echo "새로 추가된 머지 내역이 없습니다." >> /tmp/pr_body.md
fi
PR_NUMBER=$(gh pr list --base main --head develop --state open --json number -q '.[0].number')
if [ -z "$PR_NUMBER" ]; then
gh pr create \
--base main \
--head develop \
--title "[배포 대기] main 최신화" \
--body-file /tmp/pr_body.md \
--label "main"
else
gh pr edit $PR_NUMBER \
--title "[배포 대기] main 최신화" \
--body-file /tmp/pr_body.md \
--add-label "main"
fi