-
Notifications
You must be signed in to change notification settings - Fork 20
37 lines (32 loc) · 1.02 KB
/
update_nix.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Update Nix
on:
schedule:
- cron: "0 0 * * 4"
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"