i have low inteligence
This commit is contained in:
parent
6001990b48
commit
45bd22bee7
1 changed files with 9 additions and 5 deletions
|
|
@ -12,7 +12,7 @@ jobs:
|
|||
- name: Checkout Local Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # 전체 커밋 히스토리를 가져와 비교 및 머지가 가능하도록 설정
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
|
|
@ -27,17 +27,21 @@ jobs:
|
|||
- name: Check for Changes and Push Branch
|
||||
id: check_changes
|
||||
run: |
|
||||
if ! git diff --quiet HEAD upstream/dev; then
|
||||
# 1. 로컬에 올라가 있는 'origin/dev'와 'upstream/dev'의 최신 커밋 해시를 비교합니다.
|
||||
LOCAL_REFS=$(git rev-parse origin/dev)
|
||||
UPSTREAM_REFS=$(git rev-parse upstream/dev)
|
||||
|
||||
if [ "$LOCAL_REFS" != "$UPSTREAM_REFS" ]; then
|
||||
echo "New changes detected in upstream."
|
||||
|
||||
BRANCH_NAME="upstream-sync-$(date +'%Y%m%d%H%M')"
|
||||
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||
|
||||
git checkout -b $BRANCH_NAME
|
||||
# --allow-unrelated-histories 플래그를 추가하여 독립된 히스토리 간의 병합을 허용
|
||||
git merge upstream/dev --no-edit --allow-unrelated-histories
|
||||
# 2. 관련 없는 히스토리 문제를 피하기 위해, 'upstream/dev'에서 직접 새 브랜치를 생성합니다.
|
||||
git checkout -b $BRANCH_NAME upstream/dev
|
||||
|
||||
# 3. 생성한 브랜치를 원격(origin)에 푸시합니다.
|
||||
git push origin $BRANCH_NAME
|
||||
else
|
||||
echo "No changes detected. Everything is up to date."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue