Merge branch 'nunchaku-tech:main' into main #7
This file contains hidden or 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
| name: Merge main into dev | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| merge-main-into-dev: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'nunchaku-tech/ComfyUI-nunchaku' | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GH_TOKEN }} | |
| - name: Check if main and dev are already in sync | |
| id: check_sync | |
| run: | | |
| git fetch origin main dev | |
| MAIN_SHA=$(git rev-parse origin/main) | |
| DEV_SHA=$(git rev-parse origin/dev) | |
| echo "main sha: $MAIN_SHA" | |
| echo "dev sha: $DEV_SHA" | |
| if [ "$MAIN_SHA" = "$DEV_SHA" ]; then | |
| echo "Branches are in sync. Skipping merge." | |
| echo "skip_merge=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Branches differ. Proceeding with merge." | |
| echo "skip_merge=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Merge main into dev | |
| id: last_commit | |
| if: steps.check_sync.outputs.skip_merge == 'false' | |
| run: | | |
| # 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) | |
| echo "Author: $AUTHOR_NAME <$AUTHOR_EMAIL>" | |
| echo "Last commit message: $LAST_MSG" | |
| # Set Git user to last author | |
| git config --global user.name "$AUTHOR_NAME" | |
| git config --global user.email "$AUTHOR_EMAIL" | |
| git checkout dev | |
| git merge origin/main -m "[Auto Merge] $LAST_MSG" | |
| git push origin dev |