Compare commits
13 Commits
c4d8972c9a
...
main
Author | SHA1 | Date | |
---|---|---|---|
3263a37074 | |||
fc412f2596 | |||
c9862e6efc | |||
ed52562b55 | |||
8d9892e958 | |||
489b839452 | |||
3801bbda11 | |||
a2a3d2586c | |||
2ac3af7a53 | |||
b0b6ef6bba | |||
595a9761d0 | |||
9fa984aa14 | |||
4cce287379 |
@ -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 reset branch
|
||||
- name: Git config
|
||||
shell: bash
|
||||
run: |
|
||||
git fetch origin main
|
||||
git reset --hard origin/main
|
||||
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
|
||||
@ -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 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 --force-with-lease origin flake-updates
|
||||
|
Reference in New Issue
Block a user