Update Nix #20
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 3 * * 1" | |
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@v25 | |
- 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 "noreply@github.com" | |
BRANCH="nix-update-$(date -I)" | |
git checkout -b "$BRANCH" | |
git add flake.lock | |
git commit --message "update Nix sources" --author "GitHub Actions <noreply@github.com>" | |
git push -u origin "$BRANCH" | |
gh pr create \ | |
--title "update Nix sources, $(date -I)" \ | |
--body "Automatically generated by GitHub actions at $(date)" \ | |
--head "$BRANCH" |