Skip to content

Commit 321fb79

Browse files
committed
fix: Detect if it's running on a self-hosted runner and skip nix install
1 parent 3c34e29 commit 321fb79

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/actions/nix-install-ephemeral/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,19 @@ runs:
3636
sudo chmod +x /etc/nix/upload-to-cache.sh
3737
env:
3838
NIX_SIGN_SECRET_KEY: ${{ env.NIX_SIGN_SECRET_KEY }}
39+
- name: Check runner type
40+
id: check-runner
41+
shell: bash
42+
run: |
43+
if [[ "${{ runner.name }}" == *"GitHub Actions"* ]] || [[ "$RUNNER_ENVIRONMENT" == "github-hosted" ]]; then
44+
echo "is_self_hosted=false" >> $GITHUB_OUTPUT
45+
echo "Running on GitHub-hosted runner, will install Nix"
46+
else
47+
echo "is_self_hosted=true" >> $GITHUB_OUTPUT
48+
echo "Running on self-hosted runner, skipping Nix installation (should be pre-installed)"
49+
fi
3950
- name: Install nix
51+
if: steps.check-runner.outputs.is_self_hosted != 'true'
4052
uses: cachix/install-nix-action@v31
4153
with:
4254
install_url: https://releases.nixos.org/nix/nix-2.32.2/install

0 commit comments

Comments
 (0)