nixos-config/.forgejo/workflows/update_nix_flakes.yml
Ingolf Wagner 65c531536d
All checks were successful
Build all NixOS Configurations / nix build (push) Successful in 2s
try to fix the git push frogejo action
2024-07-21 11:22:13 +02:00

50 lines
1.2 KiB
YAML

name: Update Nix flakes and commit changes
on:
schedule:
- cron: "10 11 * * *" # not to frequent, GitHub only allows a few pulls per hour
jobs:
update-and-commit:
runs-on: native
steps:
- name: checkout repository
uses: actions/checkout@v2
with:
ref: "update"
depth: 0
- name: setup git
run: |
git config --local user.email "action@git.ingolf-wagner.de"
git config --local user.name "Forgejo Action"
# fixme: not working for some reason
#- name: rebase with main branch
# run: |
# git fetch origin main
# git rebase origin/main
- name: update nix flakes
run: |
cat <<EOF > .ssh_key
${{ secrets.SSH_KEY }}
EOF
chmod 600 .ssh_key
eval $(ssh-agent)
ssh-add .ssh_key
nix flake update
export GIT_SSH_COMMAND="ssh -i .ssh_key -F /dev/null"
git diff --quiet && \
git diff --staged --quiet || \
(git commit -am "Update Nix flakes" && git push)
echo $SSH_AGENT_PID
kill $SSH_AGENT_PID