Skip to content

Commit 8eaba7c

Browse files
authored
fix: Behavior if pixi is on path with spaces (#185)
1 parent 0aa0cc0 commit 8eaba7c

File tree

6 files changed

+44
-40
lines changed

6 files changed

+44
-40
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dist/** -diff linguist-generated=true
1+
dist/** merge=binary -diff linguist-generated=true

.github/workflows/test.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -247,30 +247,30 @@ jobs:
247247
run: mv test/default/* .
248248
- name: Create pixi directory and add to PATH
249249
run: |
250-
mkdir -p $HOME/custom-existing-pixi
251-
echo $HOME/custom-existing-pixi >> $GITHUB_PATH
250+
mkdir -p "$HOME/custom existing pixi"
251+
echo "$HOME/custom existing pixi" >> $GITHUB_PATH
252252
if: matrix.os != 'windows-latest'
253253
- name: Create pixi directory and add to PATH (Windows)
254254
run: |
255-
mkdir $env:USERPROFILE\custom-existing-pixi
256-
echo $env:USERPROFILE\custom-existing-pixi >> $env:GITHUB_PATH
255+
mkdir "$env:USERPROFILE\custom existing pixi"
256+
echo "$env:USERPROFILE\custom existing pixi" >> $env:GITHUB_PATH
257257
shell: pwsh
258258
if: matrix.os == 'windows-latest'
259259
- name: Download pixi binary (Ubuntu)
260260
run: |
261261
set -o pipefail
262-
curl -L --output $HOME/custom-existing-pixi/pixi https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-unknown-linux-musl
263-
chmod +x $HOME/custom-existing-pixi/pixi
262+
curl -L --output "$HOME/custom existing pixi/pixi" https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-unknown-linux-musl
263+
chmod +x "$HOME/custom existing pixi/pixi"
264264
if: matrix.os == 'ubuntu-latest'
265265
- name: Download pixi binary (macOS)
266266
run: |
267267
set -o pipefail
268-
curl -L --output $HOME/custom-existing-pixi/pixi https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-apple-darwin
269-
chmod +x $HOME/custom-existing-pixi/pixi
268+
curl -L --output "$HOME/custom existing pixi/pixi" https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-apple-darwin
269+
chmod +x "$HOME/custom existing pixi/pixi"
270270
if: matrix.os == 'macos-latest'
271271
- name: Download pixi binary (Windows)
272272
run: |
273-
curl -L --output $HOME/custom-existing-pixi/pixi.exe https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-pc-windows-msvc.exe
273+
curl -L --output "$HOME/custom existing pixi/pixi.exe" https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-pc-windows-msvc.exe
274274
if: matrix.os == 'windows-latest'
275275
- run: |
276276
echo "Path: $PATH"
@@ -282,7 +282,7 @@ jobs:
282282
shell: bash
283283
- name: Verify pixi path (before setup-pixi)
284284
run: |
285-
which pixi | grep -q $HOME/custom-existing-pixi/pixi
285+
which pixi | grep -q "$HOME/custom existing pixi/pixi"
286286
shell: bash
287287
- name: Run Action (should use preinstalled pixi)
288288
uses: ./
@@ -346,12 +346,12 @@ jobs:
346346
if: matrix.ignore-reason == 'bin-path' || matrix.ignore-reason == 'version-latest'
347347
- name: Verify pixi path (after setup-pixi, no ignore reason)
348348
run: |
349-
which pixi | grep -q $HOME/custom-existing-pixi/pixi
349+
which pixi | grep -q "$HOME/custom existing pixi/pixi"
350350
shell: bash
351351
if: matrix.ignore-reason == 'none'
352352
- name: Verify pixi path (after setup-pixi, ignore reason)
353353
run: |
354-
which pixi | grep -vq $HOME/custom-existing-pixi/pixi
354+
which pixi | grep -vq "$HOME/custom existing pixi/pixi"
355355
shell: bash
356356
if: matrix.ignore-reason != 'none'
357357

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m
2323
## Usage
2424

2525
```yml
26-
- uses: prefix-dev/[email protected].3
26+
- uses: prefix-dev/[email protected].4
2727
with:
28-
pixi-version: v0.41.4
28+
pixi-version: v0.44.0
2929

3030
cache: true
3131
auth-host: prefix.dev
@@ -35,7 +35,7 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m
3535
3636
> [!WARNING]
3737
> Since pixi is not yet stable, the API of this action may change between minor versions.
38-
> Please pin the versions of this action to a specific version (i.e., `prefix-dev/[email protected].3`) to avoid breaking changes.
38+
> Please pin the versions of this action to a specific version (i.e., `prefix-dev/[email protected].4`) to avoid breaking changes.
3939
> You can automatically update the version of this action by using [Dependabot](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot).
4040
>
4141
> Put the following in your `.github/dependabot.yml` file to enable Dependabot for your GitHub Actions:
@@ -74,7 +74,7 @@ In order to not exceed the [10 GB cache size limit](https://docs.github.com/en/a
7474
This can be done by setting the `cache-write` argument.
7575

7676
```yml
77-
- uses: prefix-dev/[email protected].3
77+
- uses: prefix-dev/[email protected].4
7878
with:
7979
cache: true
8080
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
@@ -119,7 +119,7 @@ test:
119119
environment: [py311, py312]
120120
steps:
121121
- uses: actions/checkout@v4
122-
- uses: prefix-dev/[email protected].3
122+
- uses: prefix-dev/[email protected].4
123123
with:
124124
environments: ${{ matrix.environment }}
125125
```
@@ -129,7 +129,7 @@ test:
129129
The following example will install both the `py311` and the `py312` environment on the runner.
130130

131131
```yml
132-
- uses: prefix-dev/[email protected].3
132+
- uses: prefix-dev/[email protected].4
133133
with:
134134
# separated by spaces
135135
environments: >-
@@ -165,7 +165,7 @@ Specify the token using the `auth-token` input argument.
165165
This form of authentication (bearer token in the request headers) is mainly used at [prefix.dev](https://prefix.dev).
166166

167167
```yml
168-
- uses: prefix-dev/[email protected].3
168+
- uses: prefix-dev/[email protected].4
169169
with:
170170
auth-host: prefix.dev
171171
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
@@ -177,7 +177,7 @@ Specify the username and password using the `auth-username` and `auth-password`
177177
This form of authentication (HTTP Basic Auth) is used in some enterprise environments with [artifactory](https://jfrog.com/artifactory) for example.
178178

179179
```yml
180-
- uses: prefix-dev/[email protected].3
180+
- uses: prefix-dev/[email protected].4
181181
with:
182182
auth-host: custom-artifactory.com
183183
auth-username: ${{ secrets.PIXI_USERNAME }}
@@ -190,7 +190,7 @@ Specify the conda-token using the `auth-conda-token` input argument.
190190
This form of authentication (token is encoded in URL: `https://my-quetz-instance.com/t/<token>/get/custom-channel`) is used at [anaconda.org](https://anaconda.org) or with [quetz instances](https://github.com/mamba-org/quetz).
191191

192192
```yml
193-
- uses: prefix-dev/[email protected].3
193+
- uses: prefix-dev/[email protected].4
194194
with:
195195
auth-host: anaconda.org # or my-quetz-instance.com
196196
auth-conda-token: ${{ secrets.CONDA_TOKEN }}
@@ -202,7 +202,7 @@ Specify the S3 key pair using the `auth-access-key-id` and `auth-secret-access-k
202202
You can also specify the session token using the `auth-session-token` input argument.
203203

204204
```yaml
205-
- uses: prefix-dev/[email protected].3
205+
- uses: prefix-dev/[email protected].4
206206
with:
207207
auth-host: s3://my-s3-bucket
208208
auth-s3-access-key-id: ${{ secrets.ACCESS_KEY_ID }}
@@ -274,15 +274,15 @@ To this end, `setup-pixi` adds all environment variables set when executing `pix
274274
As a result, all installed binaries can be accessed without having to call `pixi run`.
275275

276276
```yml
277-
- uses: prefix-dev/[email protected].3
277+
- uses: prefix-dev/[email protected].4
278278
with:
279279
activate-environment: true
280280
```
281281

282282
If you are installing multiple environments, you will need to specify the name of the environment that you want to be activated.
283283

284284
```yml
285-
- uses: prefix-dev/[email protected].3
285+
- uses: prefix-dev/[email protected].4
286286
with:
287287
environments: >-
288288
py311
@@ -299,7 +299,7 @@ You can specify whether `setup-pixi` should run `pixi install --frozen` or `pixi
299299
See the [official documentation](https://prefix.dev/docs/pixi/cli#install) for more information about the `--frozen` and `--locked` flags.
300300

301301
```yml
302-
- uses: prefix-dev/[email protected].3
302+
- uses: prefix-dev/[email protected].4
303303
with:
304304
locked: true
305305
# or
@@ -318,7 +318,7 @@ The first one is the debug logging of the action itself.
318318
This can be enabled by running the action with the `RUNNER_DEBUG` environment variable set to `true`.
319319

320320
```yml
321-
- uses: prefix-dev/[email protected].3
321+
- uses: prefix-dev/[email protected].4
322322
env:
323323
RUNNER_DEBUG: true
324324
```
@@ -336,7 +336,7 @@ The second type is the debug logging of the pixi executable.
336336
This can be specified by setting the `log-level` input.
337337

338338
```yml
339-
- uses: prefix-dev/[email protected].3
339+
- uses: prefix-dev/[email protected].4
340340
with:
341341
# one of `q`, `default`, `v`, `vv`, or `vvv`.
342342
log-level: vvv
@@ -362,7 +362,7 @@ If nothing is specified, `post-cleanup` will default to `true`.
362362
On self-hosted runners, you also might want to alter the default pixi install location to a temporary location. You can use `pixi-bin-path: ${{ runner.temp }}/bin/pixi` to do this.
363363

364364
```yml
365-
- uses: prefix-dev/[email protected].3
365+
- uses: prefix-dev/[email protected].4
366366
with:
367367
post-cleanup: true
368368
# ${{ runner.temp }}\Scripts\pixi.exe on Windows
@@ -378,7 +378,7 @@ You can also use a preinstalled local version of pixi on the runner by not setti
378378
This can be overwritten by setting the `manifest-path` input argument.
379379

380380
```yml
381-
- uses: prefix-dev/[email protected].3
381+
- uses: prefix-dev/[email protected].4
382382
with:
383383
manifest-path: pyproject.toml
384384
```
@@ -388,7 +388,7 @@ This can be overwritten by setting the `manifest-path` input argument.
388388
If you only want to install pixi and not install the current project, you can use the `run-install` option.
389389

390390
```yml
391-
- uses: prefix-dev/[email protected].3
391+
- uses: prefix-dev/[email protected].4
392392
with:
393393
run-install: false
394394
```

dist/index.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-pixi",
3-
"version": "0.8.3",
3+
"version": "0.8.4",
44
"private": true,
55
"description": "Action to set up the pixi package manager.",
66
"scripts": {

src/util.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,17 @@ export const sha256Short = (s: BinaryLike) => {
7070
}
7171

7272
export const execute = (cmd: string[]) => {
73-
core.debug(`Executing: ${cmd.join(' ')}`)
74-
return exec(cmd[0], cmd.slice(1))
73+
core.debug(`Executing: \`${cmd.toString()}\``)
74+
// needs escaping if cmd[0] contains spaces
75+
// https://github.com/prefix-dev/setup-pixi/issues/184#issuecomment-2765724843
76+
return exec(`"${cmd[0]}"`, cmd.slice(1))
7577
}
7678

7779
export const executeGetOutput = (cmd: string[], options?: ExecOptions) => {
78-
core.debug(`Executing: ${cmd.join(' ')}`)
79-
return getExecOutput(cmd[0], cmd.slice(1), options)
80+
core.debug(`Executing: \`${cmd.toString()}\``)
81+
// needs escaping if cmd[0] contains spaces
82+
// https://github.com/prefix-dev/setup-pixi/issues/184#issuecomment-2765724843
83+
return getExecOutput(`"${cmd[0]}"`, cmd.slice(1), options)
8084
}
8185

8286
export const pixiCmd = (command: string, withManifestPath = true) => {

0 commit comments

Comments
 (0)