Skip to content

Commit f8d5a78

Browse files
committed
fix: always restore cache after Nix install
This fixes cache restoration on Macs, but shouldn't harm anything on Linux either, so to keep the logic simple just do it after on both systems.
1 parent 1d591f6 commit f8d5a78

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

discover/action.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ outputs:
1818
runs:
1919
using: "composite"
2020
steps:
21+
- name: Install Nix
22+
uses: nixbuild/nix-quick-install-action@v21
23+
if: startsWith(runner.name, 'discovery') == false
24+
with:
25+
nix_conf: |
26+
experimental-features = nix-command flakes
27+
accept-flake-config = true
28+
trusted-users = runner
29+
access-tokens = github.com=${{ inputs.github_pat }}
30+
2131
- name: Cache Nix Store
2232
id: cache-nix
2333
if: startsWith(runner.name, 'discovery') == false
@@ -32,17 +42,6 @@ runs:
3242
discovery-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}-
3343
discovery-${{ runner.os }}-${{ runner.arch }}-
3444
35-
36-
- name: Install Nix
37-
uses: nixbuild/nix-quick-install-action@v21
38-
if: startsWith(runner.name, 'discovery') == false
39-
with:
40-
nix_conf: |
41-
experimental-features = nix-command flakes
42-
accept-flake-config = true
43-
trusted-users = runner
44-
access-tokens = github.com=${{ inputs.github_pat }}
45-
4645
- name: Discover
4746
id: eval
4847
env:

run/action.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,6 @@ runs:
7474
sudo chmod 0600 ~/.ssh/known_hosts
7575
shell: bash
7676

77-
- name: Restore Cache & Discovery Results
78-
id: restore-cache
79-
if: inputs.discovery_ssh == 'none' && runner.os != 'macOS'
80-
uses: divnix/[email protected]
81-
with:
82-
path: |
83-
/nix
84-
~/.cache/nix
85-
~root/.cache/nix
86-
key: discovery-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}-${{ github.sha }}
87-
8877
- name: Install Nix
8978
uses: nixbuild/nix-quick-install-action@v21
9079
with:
@@ -98,7 +87,7 @@ runs:
9887
9988
- name: Restore Cache & Discovery Results
10089
id: restore-cache-mac
101-
if: inputs.discovery_ssh == 'none' && runner.os == 'macOS'
90+
if: inputs.discovery_ssh == 'none'
10291
uses: divnix/[email protected]
10392
with:
10493
path: |

0 commit comments

Comments
 (0)