From 51cc8f7b336c13e7c2196b9ee4f23fdcaf8b51db Mon Sep 17 00:00:00 2001 From: Bence Szikszai Date: Tue, 30 Sep 2025 11:01:22 +0200 Subject: [PATCH 1/3] Use temporary directory. --- setup-poetry/action.yml | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/setup-poetry/action.yml b/setup-poetry/action.yml index b057571..2434c32 100644 --- a/setup-poetry/action.yml +++ b/setup-poetry/action.yml @@ -24,33 +24,18 @@ runs: exit 1 fi shell: bash - - name: Set paths (Linux/Mac) - if: runner.os != 'Windows' + - name: Set paths run: | - # Use the "pipeline directory" so that tools that search the workspace - # directory for Python files will not find the Poetry cache. Use - # realpath to normalize the "../". - PIPELINE_DIR="$(realpath $GITHUB_WORKSPACE/..)" - POETRY_ROOT="$PIPELINE_DIR/.cache/poetry" - echo "POETRY_BIN_DIR=$POETRY_ROOT/bin" >> "$GITHUB_ENV" - echo "POETRY_CONFIG_DIR=$POETRY_ROOT/config" >> "$GITHUB_ENV" - echo "POETRY_HOME=$POETRY_ROOT/home" >> "$GITHUB_ENV" - echo "POETRY_HOME_BIN=$POETRY_ROOT/home/bin" >> "$GITHUB_ENV" - echo "$POETRY_ROOT/bin" >> "$GITHUB_PATH" - shell: bash - - name: Set paths (Windows) - if: runner.os == 'Windows' - run: | - # Use the "pipeline directory" so that tools that search the workspace - # directory for Python files will not find the Poetry cache. Use - # Resolve-Path to normalize the "../". - $PIPELINE_DIR = (Resolve-Path -Path "$env:GITHUB_WORKSPACE\..").Path - $POETRY_ROOT = "$PIPELINE_DIR\.cache\poetry" - Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$POETRY_ROOT\bin" - Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$POETRY_ROOT\config" - Add-Content $env:GITHUB_ENV "POETRY_HOME=$POETRY_ROOT\home" - Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$POETRY_ROOT\home\Scripts" - Add-Content $env:GITHUB_PATH "$POETRY_ROOT\bin" + $poetryRoot = Join-Path $env:RUNNER_TEMP "poetry" + $poetryHome = Join-Path $poetryRoot "home" + $poetryBin = Join-Path $poetryRoot "bin" + $binaryFolderName = if ($IsWindows) { "Scripts" } else { "bin" } + + Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$poetryBin" + Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$(Join-Path $poetryRoot "config")" + Add-Content $env:GITHUB_ENV "POETRY_HOME=$poetryHome" + Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$(Join-Path $poetryHome $binaryFolderName)" + Add-Content $env:GITHUB_PATH $poetryBin shell: pwsh - name: Copy paths from $GITHUB_ENV to $GITHUB_OUTPUT id: copy-paths @@ -88,4 +73,4 @@ runs: echo "RUNNER_TEMP=$RUNNER_TEMP" echo "RUNNER_TOOL_CACHE=$RUNNER_TOOL_CACHE" ls -al "$POETRY_BIN_DIR" "$POETRY_HOME" "$POETRY_HOME_BIN" || true - shell: bash \ No newline at end of file + shell: bash From 619b2e8b334e587ad0e553ed940c2df441a9db9e Mon Sep 17 00:00:00 2001 From: Bence Szikszai Date: Wed, 1 Oct 2025 13:45:34 +0200 Subject: [PATCH 2/3] Convert to bash. --- setup-poetry/action.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/setup-poetry/action.yml b/setup-poetry/action.yml index 2434c32..104d7c1 100644 --- a/setup-poetry/action.yml +++ b/setup-poetry/action.yml @@ -26,17 +26,21 @@ runs: shell: bash - name: Set paths run: | - $poetryRoot = Join-Path $env:RUNNER_TEMP "poetry" - $poetryHome = Join-Path $poetryRoot "home" - $poetryBin = Join-Path $poetryRoot "bin" - $binaryFolderName = if ($IsWindows) { "Scripts" } else { "bin" } + poetry_root="$RUNNER_TEMP/poetry" + poetry_home="$poetry_root/home" + poetry_bin="$poetry_root/bin" + if [[ "$RUNNER_OS" == "Windows" ]]; then + binary_folder_name="Scripts" + else + binary_folder_name="bin" + fi - Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$poetryBin" - Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$(Join-Path $poetryRoot "config")" - Add-Content $env:GITHUB_ENV "POETRY_HOME=$poetryHome" - Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$(Join-Path $poetryHome $binaryFolderName)" - Add-Content $env:GITHUB_PATH $poetryBin - shell: pwsh + echo "POETRY_BIN_DIR=$poetry_bin" >> "$GITHUB_ENV" + echo "POETRY_CONFIG_DIR=$poetry_root/config" >> "$GITHUB_ENV" + echo "POETRY_HOME=$poetry_home" >> "$GITHUB_ENV" + echo "POETRY_HOME_BIN=$poetry_home/$binary_folder_name" >> "$GITHUB_ENV" + echo "$poetry_bin" >> "$GITHUB_PATH" + shell: bash - name: Copy paths from $GITHUB_ENV to $GITHUB_OUTPUT id: copy-paths run: | From 8b4157ecbddb84c6f96c348a6f0f57be49f07421 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Thu, 2 Oct 2025 17:15:32 -0500 Subject: [PATCH 3/3] Add a poetry_config variable Co-authored-by: mshafer-NI <23644905+mshafer-NI@users.noreply.github.com> --- setup-poetry/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup-poetry/action.yml b/setup-poetry/action.yml index 104d7c1..f9925e2 100644 --- a/setup-poetry/action.yml +++ b/setup-poetry/action.yml @@ -29,6 +29,7 @@ runs: poetry_root="$RUNNER_TEMP/poetry" poetry_home="$poetry_root/home" poetry_bin="$poetry_root/bin" + poetry_config="$poetry_root/config" if [[ "$RUNNER_OS" == "Windows" ]]; then binary_folder_name="Scripts" else @@ -36,7 +37,7 @@ runs: fi echo "POETRY_BIN_DIR=$poetry_bin" >> "$GITHUB_ENV" - echo "POETRY_CONFIG_DIR=$poetry_root/config" >> "$GITHUB_ENV" + echo "POETRY_CONFIG_DIR=$poetry_config" >> "$GITHUB_ENV" echo "POETRY_HOME=$poetry_home" >> "$GITHUB_ENV" echo "POETRY_HOME_BIN=$poetry_home/$binary_folder_name" >> "$GITHUB_ENV" echo "$poetry_bin" >> "$GITHUB_PATH"