-
Notifications
You must be signed in to change notification settings - Fork 3
92 lines (89 loc) · 2.81 KB
/
flake-updater.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: "Update Flake Deps"
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * 0"
jobs:
update_flake:
runs-on: ubuntu-20.04
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
token: "${{ secrets.TEST_TOKEN }}"
- name: Install nix
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.TEST_TOKEN }}
experimental-features = nix-command flakes
substituters = https://cache.nixos.org/
install_url: https://releases.nixos.org/nix/nix-2.25.0/install
- name: Set up git
run: |
git config user.email "[email protected]"
git config user.name "Gako358"
- name: Update the flake
run: nix flake update
- name: Store flake.lock
uses: actions/upload-artifact@v4
with:
name: flake_lock
path: flake.lock
check_flake:
runs-on: ubuntu-20.04
needs: update_flake
continue-on-error: true
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
token: "${{ secrets.TEST_TOKEN }}"
- name: Install nix
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.TEST_TOKEN }}
experimental-features = nix-command flakes
substituters = https://cache.nixos.org/
install_url: https://releases.nixos.org/nix/nix-2.25.0/install
- name: Restore flake.lock
uses: actions/download-artifact@v4
with:
name: flake_lock
- name: Check flake
run: nix flake check --keep-going
push_update:
runs-on: ubuntu-20.04
permissions: write-all
needs: [update_flake, check_flake]
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
token: "${{ secrets.TEST_TOKEN }}"
- name: Restore flake.lock
uses: actions/download-artifact@v4
with:
name: flake_lock
- name: Set up git
run: |
git config user.email "[email protected]"
git config user.name "Gako358"
- name: Create and merge PR
run: |
git switch -c updates-${{ github.run_id }}
git commit -am "flake.lock: Update"
git push -u origin updates-${{ github.run_id }}
PR=$(gh pr create \
--assignee Gako358 \
--base main \
--body "Automatic flake update on $(date -I)" \
--fill \
--label bot \
--title "Auto update $(date -I)")
gh pr merge $PR --merge --delete-branch
env:
GITHUB_TOKEN: ${{ secrets.TEST_TOKEN }}