Commit 1f5e03cc authored by Muyang Li's avatar Muyang Li
Browse files

[Auto Merge] chore: fix the authors of the sync commit (#314)

parents c90cc22f fa765637
...@@ -15,11 +15,6 @@ jobs: ...@@ -15,11 +15,6 @@ jobs:
if: github.repository == 'mit-han-lab/nunchaku' if: github.repository == 'mit-han-lab/nunchaku'
steps: steps:
- name: Set up Git User
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
...@@ -45,11 +40,19 @@ jobs: ...@@ -45,11 +40,19 @@ jobs:
- name: Merge main into dev - name: Merge main into dev
id: last_commit id: last_commit
if: steps.check_sync.outputs.skip_merge == 'false' if: steps.check_sync.outputs.skip_merge == 'false'
run: | run: |
git fetch origin main # Get author name and email from last commit on main
AUTHOR_NAME=$(git log origin/main -1 --pretty=format:'%an')
AUTHOR_EMAIL=$(git log origin/main -1 --pretty=format:'%ae')
LAST_MSG=$(git log origin/main -1 --pretty=%s) LAST_MSG=$(git log origin/main -1 --pretty=%s)
echo "Author: $AUTHOR_NAME <$AUTHOR_EMAIL>"
echo "Last commit message: $LAST_MSG" echo "Last commit message: $LAST_MSG"
set -e
# Set Git user to last author
git config --global user.name "$AUTHOR_NAME"
git config --global user.email "$AUTHOR_EMAIL"
git checkout dev git checkout dev
git merge origin/main -m "[Auto Merge] $LAST_MSG" git merge origin/main -m "[Auto Merge] $LAST_MSG"
git push origin dev git push origin dev
...@@ -15,11 +15,6 @@ jobs: ...@@ -15,11 +15,6 @@ jobs:
if: github.repository == 'mit-han-lab/nunchaku' if: github.repository == 'mit-han-lab/nunchaku'
steps: steps:
- name: Set up Git User
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Clone private repository - name: Clone private repository
run: | run: |
git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/mit-han-lab/nunchaku-dev.git git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/mit-han-lab/nunchaku-dev.git
...@@ -53,6 +48,10 @@ jobs: ...@@ -53,6 +48,10 @@ jobs:
# Preserve original author and amend commit message # Preserve original author and amend commit message
GIT_AUTHOR_NAME=$(git log --format='%aN' -n 1 $COMMIT) GIT_AUTHOR_NAME=$(git log --format='%aN' -n 1 $COMMIT)
GIT_AUTHOR_EMAIL=$(git log --format='%aE' -n 1 $COMMIT) GIT_AUTHOR_EMAIL=$(git log --format='%aE' -n 1 $COMMIT)
git config --global user.name "$GIT_AUTHOR_NAME"
git config --global user.email "$GIT_AUTHOR_EMAIL"
NEW_MSG="[Auto Sync] ${COMMIT_MSG}" NEW_MSG="[Auto Sync] ${COMMIT_MSG}"
PARENTS=$(git rev-list --parents -n 1 $COMMIT) PARENTS=$(git rev-list --parents -n 1 $COMMIT)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment