Skip to content

Commit 6f1bfc5

Browse files
committed
setup-poetry: Store the Poetry cache in the "pipeline directory" not the workspace directory
1 parent 1181d09 commit 6f1bfc5

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

setup-poetry/action.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,24 @@ runs:
2727
- name: Set paths (Linux/Mac)
2828
if: runner.os != 'Windows'
2929
run: |
30-
echo "POETRY_BIN_DIR=$GITHUB_WORKSPACE/.cache/poetry/bin" >> "$GITHUB_ENV"
31-
echo "POETRY_CONFIG_DIR=$GITHUB_WORKSPACE/.cache/poetry/config" >> "$GITHUB_ENV"
32-
echo "POETRY_HOME=$GITHUB_WORKSPACE/.cache/poetry/home" >> "$GITHUB_ENV"
33-
echo "POETRY_HOME_BIN=$GITHUB_WORKSPACE/.cache/poetry/home/bin" >> "$GITHUB_ENV"
34-
echo "$GITHUB_WORKSPACE/.cache/poetry/bin" >> "$GITHUB_PATH"
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"
32+
echo "POETRY_BIN_DIR=$POETRY_ROOT/bin" >> "$GITHUB_ENV"
33+
echo "POETRY_CONFIG_DIR=$POETRY_ROOT/config" >> "$GITHUB_ENV"
34+
echo "POETRY_HOME=$POETRY_ROOT/home" >> "$GITHUB_ENV"
35+
echo "POETRY_HOME_BIN=$POETRY_ROOT/home/bin" >> "$GITHUB_ENV"
36+
echo "$POETRY_ROOT/bin" >> "$GITHUB_PATH"
3537
shell: bash
3638
- name: Set paths (Windows)
3739
if: runner.os == 'Windows'
3840
run: |
39-
Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$env:GITHUB_WORKSPACE\.cache\poetry\bin"
40-
Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$env:GITHUB_WORKSPACE\.cache\poetry\config"
41-
Add-Content $env:GITHUB_ENV "POETRY_HOME=$env:GITHUB_WORKSPACE\.cache\poetry\home"
42-
Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$env:GITHUB_WORKSPACE\.cache\poetry\home\Scripts"
43-
Add-Content $env:GITHUB_PATH "$env:GITHUB_WORKSPACE\.cache\poetry\bin"
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+
Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$env:POETRY_ROOT\bin"
44+
Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$env:POETRY_ROOT\config"
45+
Add-Content $env:GITHUB_ENV "POETRY_HOME=$env:POETRY_ROOT\home"
46+
Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$env:POETRY_ROOT\home\Scripts"
47+
Add-Content $env:GITHUB_PATH "$env:POETRY_ROOT\bin"
4448
shell: pwsh
4549
- name: Copy paths from $GITHUB_ENV to $GITHUB_OUTPUT
4650
id: copy-paths

0 commit comments

Comments
 (0)