From b76da6e9eba8d3fe7d5fc78cab42051217cc3557 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Sat, 22 Mar 2025 09:05:43 +0100 Subject: [PATCH] workflow: use merge --squash instead of rebase --- .gitea/workflows/update-flake.yaml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/update-flake.yaml b/.gitea/workflows/update-flake.yaml index 76389b6..864465d 100644 --- a/.gitea/workflows/update-flake.yaml +++ b/.gitea/workflows/update-flake.yaml @@ -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)"