workflow: use merge --squash instead of rebase

This commit is contained in:
Julian Mutter 2025-03-22 09:05:43 +01:00
parent 68e02739be
commit b76da6e9eb

View File

@ -16,10 +16,29 @@ jobs:
fetch-depth: 0
ref: flake-updates
- name: Fetch latest changes and reset branch
- name: Git config
shell: bash
run: |
git fetch origin master
git reset --hard origin/master
git config user.name "Gitea Actions"
git config user.email "actions@gitea.local"
- name: Merge master branch
shell: bash
run: |
commits_ahead=$(git rev-list --count HEAD..origin/master)
echo "Commits ahead: $commits_ahead"
git log --oneline -5
echo "----------"
git log --oneline -5 origin/master
if [ $commits_ahead -ne 0 ]
then
git fetch origin
git merge -X theirs --squash origin/master
git commit -m "Merge master branch squashed $(date -I)"
else
echo "Merge not necessary"
fi
- name: Set up Nix
uses: cachix/install-nix-action@v31
@ -30,10 +49,8 @@ jobs:
- name: Commit and push changes
shell: bash
run: |
git config user.name "Gitea Actions"
git config user.email "actions@gitea.local"
git add flake.lock
if git diff --cached --quiet; then
if git diff --quiet; then
echo "No changes to commit."
else
git commit -m "Update flake.lock $(date -I)"