Update Nix #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Nix | |
on: | |
schedule: | |
- cron: "0 0 * * 2" | |
workflow_dispatch: | |
jobs: | |
update-nix: | |
name: Update Nix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
ssh-key: ${{ secrets.UPDATE_SSH_KEY }} | |
- uses: cachix/install-nix-action@v30 | |
- run: nix flake update | |
- name: Create PR | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
if test -z "$(git status)"; then exit 0; fi | |
git config --global user.name "Github Actions" | |
git config --global user.email "[email protected]" | |
BRANCH="nix-update-$(date -I)" | |
git checkout -b "$BRANCH" | |
git add flake.lock | |
git commit --message "update Nix sources" --author "GitHub Actions <[email protected]>" | |
git push -u origin "$BRANCH" | |
gh pr create \ | |
--title "update Nix sources, $(date -I)" \ | |
--body "Automatically generated by GitHub actions at $(date)" \ | |
--head "$BRANCH" |