61 lines
1.5 KiB
YAML
61 lines
1.5 KiB
YAML
name: Update Nix Flake
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "30 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: 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
|
|
|
|
- name: Update Flake
|
|
run: nix flake update
|
|
|
|
- name: Commit and push changes
|
|
shell: bash
|
|
run: |
|
|
git status
|
|
|
|
git diff
|
|
|
|
git add flake.lock
|
|
git diff --quiet && echo "No changes to commit." && exit 0
|
|
|
|
git commit -m "Update flake.lock $(date -I)"
|
|
git push origin flake-updates
|