Skip to content

Commit 3fa7304

Browse files
committed
setup-poetry: Normalize path
1 parent 1741ed7 commit 3fa7304

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

setup-poetry/action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ runs:
2727
- name: Set paths (Linux/Mac)
2828
if: runner.os != 'Windows'
2929
run: |
30-
# Use the "pipeline directory" so that tools running in the workspace directory will not find the Poetry cache.
31-
POETRY_ROOT="$GITHUB_WORKSPACE/../.cache/poetry"
30+
# Use the "pipeline directory" so that tools that search the workspace
31+
# directory for Python files will not find the Poetry cache. Use
32+
# realpath to normalize the "../".
33+
POETRY_ROOT="$(realpath $GITHUB_WORKSPACE/../.cache/poetry)"
3234
echo "POETRY_BIN_DIR=$POETRY_ROOT/bin" >> "$GITHUB_ENV"
3335
echo "POETRY_CONFIG_DIR=$POETRY_ROOT/config" >> "$GITHUB_ENV"
3436
echo "POETRY_HOME=$POETRY_ROOT/home" >> "$GITHUB_ENV"
@@ -38,8 +40,10 @@ runs:
3840
- name: Set paths (Windows)
3941
if: runner.os == 'Windows'
4042
run: |
41-
# Use the "pipeline directory" so that tools running in the workspace directory will not find the Poetry cache.
42-
$env:POETRY_ROOT="$env:GITHUB_WORKSPACE\..\.cache\poetry"
43+
# Use the "pipeline directory" so that tools that search the workspace
44+
# directory for Python files will not find the Poetry cache. Use
45+
# Resolve-Path to normalize the "../".
46+
$env:POETRY_ROOT=(Resolve-Path -Path "$env:GITHUB_WORKSPACE\..\.cache\poetry").Path
4347
Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$env:POETRY_ROOT\bin"
4448
Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$env:POETRY_ROOT\config"
4549
Add-Content $env:GITHUB_ENV "POETRY_HOME=$env:POETRY_ROOT\home"

0 commit comments

Comments
 (0)