From 1093c35803d2dfb4609fbd99756c6ba6702b0d17 Mon Sep 17 00:00:00 2001 From: Gitea Actions Date: Sat, 22 Mar 2025 09:51:52 +0000 Subject: [PATCH] Merge main branch squashed 2025-03-22 --- .gitea/workflows/update-flake.yaml | 40 +++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/update-flake.yaml b/.gitea/workflows/update-flake.yaml index 0f6bc1e..788b3b0 100644 --- a/.gitea/workflows/update-flake.yaml +++ b/.gitea/workflows/update-flake.yaml @@ -2,7 +2,7 @@ name: Update Nix Flake on: schedule: - - cron: "30 0 * * *" # daily run + - cron: "45 0 * * *" # daily run workflow_dispatch: {} jobs: @@ -16,10 +16,29 @@ jobs: fetch-depth: 0 ref: flake-updates - - name: Fetch latest changes and rebase + - name: Git config + shell: bash run: | - git fetch origin - git rebase origin/main + git config user.name "Gitea Actions" + git config user.email "actions@gitea.local" + + - name: Merge main branch + shell: bash + run: | + commits_ahead=$(git rev-list --count HEAD..origin/main) + echo "Commits ahead: $commits_ahead" + git log --oneline -5 + echo "----------" + git log --oneline -5 origin/main + + if [ $commits_ahead -ne 0 ] + then + git fetch origin + git merge -X theirs --squash origin/main + git commit -m "Merge main branch squashed $(date -I)" + else + echo "Merge not necessary" + fi - name: Set up Nix uses: cachix/install-nix-action@v31 @@ -30,12 +49,9 @@ 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 - echo "No changes to commit." - else - git commit -m "Update flake.lock $(date -I)" - git push --force-with-lease origin flake-updates - fi + git status + git diff --cached --quiet && echo "No changes to commit." && exit 0 + + git commit -m "Update flake.lock $(date -I)" + git push origin flake-updates