Skip to content

Commit d58962a

Browse files
committed
setup-poetry: Only normalize the part of the path that exists
1 parent 3fa7304 commit d58962a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

setup-poetry/action.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ runs:
2929
run: |
3030
# Use the "pipeline directory" so that tools that search the workspace
3131
# directory for Python files will not find the Poetry cache. Use
32-
# realpath to normalize the "../".
33-
POETRY_ROOT="$(realpath $GITHUB_WORKSPACE/../.cache/poetry)"
32+
# realpath to normalize the "../".
33+
PIPELINE_DIR="$(realpath $GITHUB_WORKSPACE/..)"
34+
POETRY_ROOT="$PIPELINE_DIR/.cache/poetry"
3435
echo "POETRY_BIN_DIR=$POETRY_ROOT/bin" >> "$GITHUB_ENV"
3536
echo "POETRY_CONFIG_DIR=$POETRY_ROOT/config" >> "$GITHUB_ENV"
3637
echo "POETRY_HOME=$POETRY_ROOT/home" >> "$GITHUB_ENV"
@@ -43,12 +44,13 @@ runs:
4344
# Use the "pipeline directory" so that tools that search the workspace
4445
# directory for Python files will not find the Poetry cache. Use
4546
# Resolve-Path to normalize the "../".
46-
$env:POETRY_ROOT=(Resolve-Path -Path "$env:GITHUB_WORKSPACE\..\.cache\poetry").Path
47-
Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$env:POETRY_ROOT\bin"
48-
Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$env:POETRY_ROOT\config"
49-
Add-Content $env:GITHUB_ENV "POETRY_HOME=$env:POETRY_ROOT\home"
50-
Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$env:POETRY_ROOT\home\Scripts"
51-
Add-Content $env:GITHUB_PATH "$env:POETRY_ROOT\bin"
47+
$PIPELINE_DIR = (Resolve-Path -Path "$env:GITHUB_WORKSPACE\..").Path
48+
$POETRY_ROOT = "$PIPELINE_DIR\.cache\poetry"
49+
Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$POETRY_ROOT\bin"
50+
Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$POETRY_ROOT\config"
51+
Add-Content $env:GITHUB_ENV "POETRY_HOME=$POETRY_ROOT\home"
52+
Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$POETRY_ROOT\home\Scripts"
53+
Add-Content $env:GITHUB_PATH "$POETRY_ROOT\bin"
5254
shell: pwsh
5355
- name: Copy paths from $GITHUB_ENV to $GITHUB_OUTPUT
5456
id: copy-paths

0 commit comments

Comments
 (0)