name: Update Nix flakes and commit changes on: schedule: - cron: "30 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 < .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