Skip to content

Commit 158cdc9

Browse files
committed
ci: add update flake workflow
1 parent ac10667 commit 158cdc9

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/update.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Update Flake
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "43 3 */10 * *" # run every ten days at 3:43 am
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
update:
14+
name: "nix flake update"
15+
runs-on: ubuntu-24.04
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
20+
with:
21+
fetch-depth: 0
22+
23+
- uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
24+
25+
- name: nix flake update
26+
run: |
27+
git config user.name 'github-actions[bot]'
28+
git config user.email 'github-actions[bot]@users.noreply.github.com'
29+
30+
git branch -f auto/update-flake origin/main
31+
git checkout auto/update-flake
32+
33+
nix flake update --commit-lock-file
34+
35+
git push --force origin auto/update-flake
36+
37+
- name: "Create pull request"
38+
env:
39+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: |
41+
if ! gh pr list --head update --json number --base main | grep -q number; then
42+
gh pr create --base main --head update --title "Update Flake" --body ""
43+
fi

0 commit comments

Comments
 (0)