Skip to content

Commit 662f4c1

Browse files
committed
ci: add update flake workflow
1 parent ac10667 commit 662f4c1

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/update.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
env:
9+
BRANCH: auto/update-flake
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
update:
17+
name: "nix flake update"
18+
runs-on: ubuntu-24.04
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
23+
24+
- uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
25+
26+
- name: nix flake update
27+
run: |
28+
git config user.name 'github-actions[bot]'
29+
git config user.email 'github-actions[bot]@users.noreply.github.com'
30+
31+
if git ls-remote --exit-code --heads origin ${BRANCH}; then
32+
git fetch origin ${BRANCH}:${BRANCH}
33+
git checkout ${BRANCH}
34+
git reset --hard origin/main
35+
else
36+
git checkout -b ${BRANCH}
37+
fi
38+
39+
nix flake update --commit-lock-file
40+
41+
git push --force origin ${BRANCH}
42+
43+
- name: "Create pull request"
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: |
47+
gh pr create --base main --head ${BRANCH} --title "Update Flake" --body "" || true

0 commit comments

Comments
 (0)