Skip to content

Commit 0ef60fd

Browse files
committed
refactor(gh-actions): Use bash heredoc string
1 parent 4379536 commit 0ef60fd

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

.github/install-nix/action.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ runs:
3232
shell: bash
3333
run: |
3434
mkdir -p $HOME/.config/nix
35-
{
36-
echo "machine ${{inputs.cachix-cache}}.cachix.org password ${{inputs.cachix-auth-token}}"
37-
} >> $HOME/.config/nix/netrc
38-
{
39-
echo "${{ inputs.nix-github-token != '' && format('access-tokens = github.com={0}', inputs.nix-github-token) || '' }}
40-
accept-flake-config = true
35+
36+
cat << EOF > "$HOME/.config/nix/nix.conf"
37+
${{ inputs.nix-github-token != '' && format('access-tokens = github.com={0}', inputs.nix-github-token) || '' }}
4138
allow-import-from-derivation = true
4239
substituters = https://cache.nixos.org ${{inputs.substituters}}
4340
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ${{inputs.trusted-public-keys}}
4441
netrc-file = $HOME/.config/nix/netrc"
45-
} > $HOME/.config/nix/nix.conf
42+
EOF
43+
44+
cat << EOF > "$HOME/.config/nix/netrc"
45+
machine ${{inputs.cachix-cache}}.cachix.org password ${{inputs.cachix-auth-token}}
46+
EOF

.github/workflows/update-flake-lock.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ jobs:
3636
shell: bash
3737
run: |
3838
mkdir -p $HOME/.config/nix
39-
{
40-
echo "${{ secrets.NIX_GITHUB_TOKEN != '' && format('access-tokens = github.com={0}', secrets.NIX_GITHUB_TOKEN) || '' }}
41-
accept-flake-config = true"
42-
} > $HOME/.config/nix/nix.conf
43-
39+
cat << EOF > "$HOME/.config/nix/nix.conf"
40+
${{ secrets.NIX_GITHUB_TOKEN != '' && format('access-tokens = github.com={0}', secrets.NIX_GITHUB_TOKEN) || '' }}
41+
allow-import-from-derivation = true
42+
EOF
4443
4544
- name: Run `nix flake update`
4645
id: update-lockfile

.github/workflows/update-flake-packages.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ jobs:
3636
shell: bash
3737
run: |
3838
mkdir -p $HOME/.config/nix
39-
{
40-
echo "${{ secrets.NIX_GITHUB_TOKEN != '' && format('access-tokens = github.com={0}', secrets.NIX_GITHUB_TOKEN) || '' }}
41-
accept-flake-config = true
42-
allow-import-from-derivation = true"
43-
} > $HOME/.config/nix/nix.conf
39+
cat << EOF > "$HOME/.config/nix/nix.conf"
40+
${{ secrets.NIX_GITHUB_TOKEN != '' && format('access-tokens = github.com={0}', secrets.NIX_GITHUB_TOKEN) || '' }}
41+
allow-import-from-derivation = true
42+
EOF
4443
4544
- uses: tibdex/[email protected]
4645
id: generate-token

0 commit comments

Comments
 (0)