-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
309684b
commit 295f3e6
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
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,45 @@ | ||
name: Auto Create or Update PR | ||
|
||
on: | ||
push: | ||
branches: | ||
[ | ||
feature/*, | ||
release/*, | ||
bugfix/*, | ||
hotfix/*, | ||
refactor/*, | ||
test/*, | ||
docs/*, | ||
chore/*, | ||
] | ||
|
||
jobs: | ||
auto_pr: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create or Update PR | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# 현재 브랜치 이름 가져오기 | ||
CURRENT_BRANCH=$(echo $GITHUB_REF | sed 's|refs/heads/||') | ||
echo "Current branch: $CURRENT_BRANCH" | ||
# 기존 PR이 있는지 확인 | ||
EXISTING_PR=$(gh pr list --head "$CURRENT_BRANCH" --json number -q ".[0].number") | ||
if [ -z "$EXISTING_PR" ]; then | ||
echo "No existing PR. Creating a new one..." | ||
gh pr create \ | ||
--title "Auto PR for $CURRENT_BRANCH" \ | ||
--body "This PR was automatically created for the branch $CURRENT_BRANCH." \ | ||
--base main | ||
else | ||
echo "PR #$EXISTING_PR exists. Syncing with the latest changes..." | ||
gh pr comment "$EXISTING_PR" --body "Branch updated with new changes." | ||
fi |