Action extra conf can be lacking newline (#175)

* Try extra-conf with a heredoc

* Test case

* Other test case

* heredoc in yaml goes burr

* use special bash syntax for newline

* Correctly close quotes

* Remove testing symbols

* Use file method

* unwhoops jobs
This commit is contained in:
Ana Hobden 2023-01-11 11:42:35 -08:00 committed by GitHub
parent 20aa4cdf0b
commit 82ec255060
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View file

@ -346,6 +346,8 @@ jobs:
log-directives: nix_installer=trace
backtrace: full
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: |
trusted-users = root runner
- name: Initial uninstall (without a `nix run` first)
run: sudo -E /nix/nix-installer uninstall
env:
@ -361,6 +363,7 @@ jobs:
log-directives: nix_installer=trace
backtrace: full
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: trusted-users = root runner
- name: echo $PATH
run: echo $PATH
- name: Test `nix` with `$GITHUB_PATH`

View file

@ -115,19 +115,17 @@ runs:
echo "Set NIX_INSTALLER_NIX_PACKAGE_URL=$NIX_INSTALLER_NIX_PACKAGE_URL"
fi
export NIX_INSTALLER_EXTRA_CONF_FILE=/tmp/extra-nix-config
touch $NIX_INSTALLER_EXTRA_CONF_FILE
if [ -n "${{ inputs.extra-conf }}" ]; then
echo "${{ inputs.extra-conf }}" >> $NIX_INSTALLER_EXTRA_CONF_FILE
fi
if [ -n "${{ inputs.github-token }}" ]; then
export NIX_INSTALLER_EXTRA_CONF="${{ inputs.extra-conf }}access-tokens = github.com=${{ inputs.github-token }}"
else
export NIX_INSTALLER_EXTRA_CONF="${{ inputs.extra-conf }}"
echo "access-tokens = github.com=${{ inputs.github-token }}" >> $NIX_INSTALLER_EXTRA_CONF_FILE
fi
export NIX_INSTALLER_EXTRA_CONF="$(cat $NIX_INSTALLER_EXTRA_CONF_FILE)"
echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF"
else
if [ -n "${{ inputs.github-token }}" ]; then
export NIX_INSTALLER_EXTRA_CONF="access-tokens = github.com=${{ inputs.github-token }}"
echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF"
fi
fi
if [ -n "${{ inputs.mac-encrypt }}" ]; then
export NIX_INSTALLER_ENCRYPT=${{ inputs.mac-encrypt }}