hydra-jobs/.gitea/workflows/update-flake.yaml
Julian Mutter 3263a37074
Some checks failed
Update Nix Flake / update-flake (push) Failing after 16s
workflow: push right after rebasing
2025-03-23 18:57:16 +01:00

58 lines
1.5 KiB
YAML

name: Update Nix Flake
on:
schedule:
- cron: "45 0 * * *" # daily run
workflow_dispatch: {}
jobs:
update-flake:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: "${{ gitea.token }}"
fetch-depth: 0
ref: flake-updates
- name: Git config
shell: bash
run: |
git config user.name "Gitea Actions"
git config user.email "actions@gitea.local"
- name: Rebase from 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
echo .
if [ $commits_ahead -ne 0 ]
then
git rebase -X theirs origin/main
git push --force-with-lease origin flake-updates
else
echo "Rebase not necessary"
fi
- name: Set up Nix
uses: cachix/install-nix-action@v31
- name: Update Flake
run: nix flake update
- name: Commit and push changes
shell: bash
run: |
git add flake.lock
git status
git diff --cached --quiet && echo "No changes to commit." && exit 0
git commit -m "Update flake.lock $(date -I)"
git push --force-with-lease origin flake-updates