From 32eb18cd382407d1991bdb1efe4b6d4bdd3eb4b8 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 15 Jun 2026 15:39:52 +0200 Subject: [PATCH 1/5] Support invoking the action twice in the same job Calling the action twice in one job failed: both runs shared $RUNNER_TEMP/.bin, so the second unzip hit a non-interactive overwrite prompt and exited 1. Each invocation now downloads into its own mktemp -d "$RUNNER_TEMP/databricks.XXXXXX" dir. A unique per-invocation dir keeps us fully isolated from other actions sharing $RUNNER_TEMP, and lets repeated calls coexist without deleting anything. Co-authored-by: Isaac --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ setup_release.sh | 9 +++++---- setup_snapshot.sh | 11 +++++++---- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e2e0dda..67c8a88d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,6 +72,43 @@ jobs: - run: ./setup-cli/assert/clean.sh shell: bash + action_twice: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: ./setup-cli + + # Confirm the action can be invoked more than once in the same job, and + # that each invocation resolves to its own binary. + - uses: ./setup-cli + + - run: echo $(which databricks) + shell: bash + + - uses: ./setup-cli + + - run: echo $(which databricks) + shell: bash + + - run: databricks version + shell: bash + + - run: ./setup-cli/assert/version.sh $(cat ./setup-cli/VERSION) + shell: bash + + - run: ./setup-cli/assert/clean.sh + shell: bash + install: runs-on: ${{ matrix.os }} diff --git a/setup_release.sh b/setup_release.sh index 4f2303ff..57fb5779 100644 --- a/setup_release.sh +++ b/setup_release.sh @@ -38,16 +38,17 @@ ARM64) ;; esac -# Change into temporary directory. -cd "$RUNNER_TEMP" +# Use a unique directory per invocation so repeated calls in the same job (and +# other tools using $RUNNER_TEMP) don't collide. +dir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" +cd "$dir" # Download release archive. curl -fsSL -O "https://github.com/databricks/cli/releases/download/v${VERSION}/${FILE}.zip" # Unzip release archive. -unzip -q "${FILE}.zip" -d .bin +unzip -q "${FILE}.zip" # Add databricks to path. -dir=$PWD/.bin chmod +x "${dir}/databricks" echo "$dir" >> "$GITHUB_PATH" diff --git a/setup_snapshot.sh b/setup_snapshot.sh index 92549f52..45018aec 100755 --- a/setup_snapshot.sh +++ b/setup_snapshot.sh @@ -66,12 +66,15 @@ macOS) ;; esac -# Change into temporary directory. -cd "$RUNNER_TEMP" +# Use a unique directory per invocation so repeated calls in the same job (and +# other tools using $RUNNER_TEMP) don't collide. An empty directory also keeps +# "gh run download" and the Windows rename below working on repeat calls. +tmpdir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" +cd "$tmpdir" -gh run download "$last_successful_run_id" -n "$artifact" -D .bin +gh run download "$last_successful_run_id" -n "$artifact" -D . -dir="$PWD/.bin/$(cli_snapshot_directory)" +dir="$PWD/$(cli_snapshot_directory)" if [ ! -d "$dir" ]; then echo "Directory does not exist: $dir" From 331b41162710a4be4c83beecd144469b0a95748f Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 15 Jun 2026 15:56:53 +0200 Subject: [PATCH 2/5] Link GitHub docs for $RUNNER_TEMP cleanup semantics Cite the Variables reference, which documents that $RUNNER_TEMP is emptied at the beginning and end of each job -- explaining why the per-invocation directories need no manual cleanup. Co-authored-by: Isaac --- setup_release.sh | 4 +++- setup_snapshot.sh | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/setup_release.sh b/setup_release.sh index 57fb5779..67658e39 100644 --- a/setup_release.sh +++ b/setup_release.sh @@ -39,7 +39,9 @@ ARM64) esac # Use a unique directory per invocation so repeated calls in the same job (and -# other tools using $RUNNER_TEMP) don't collide. +# other tools using $RUNNER_TEMP) don't collide. $RUNNER_TEMP is emptied at the +# beginning and end of each job, so it needs no manual cleanup. See: +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables dir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" cd "$dir" diff --git a/setup_snapshot.sh b/setup_snapshot.sh index 45018aec..4f198c5c 100755 --- a/setup_snapshot.sh +++ b/setup_snapshot.sh @@ -69,6 +69,9 @@ esac # Use a unique directory per invocation so repeated calls in the same job (and # other tools using $RUNNER_TEMP) don't collide. An empty directory also keeps # "gh run download" and the Windows rename below working on repeat calls. +# $RUNNER_TEMP is emptied at the beginning and end of each job, so it needs no +# manual cleanup. See: +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables tmpdir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" cd "$tmpdir" From fb70dc82c83cbaeedbd305b817d82e4bc0338650 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 15 Jun 2026 15:58:18 +0200 Subject: [PATCH 3/5] Put the $RUNNER_TEMP docs link in its own paragraph Co-authored-by: Isaac --- setup_release.sh | 5 +++-- setup_snapshot.sh | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/setup_release.sh b/setup_release.sh index 67658e39..285090ba 100644 --- a/setup_release.sh +++ b/setup_release.sh @@ -40,8 +40,9 @@ esac # Use a unique directory per invocation so repeated calls in the same job (and # other tools using $RUNNER_TEMP) don't collide. $RUNNER_TEMP is emptied at the -# beginning and end of each job, so it needs no manual cleanup. See: -# https://docs.github.com/en/actions/reference/workflows-and-actions/variables +# beginning and end of each job, so it needs no manual cleanup. +# +# See https://docs.github.com/en/actions/reference/workflows-and-actions/variables dir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" cd "$dir" diff --git a/setup_snapshot.sh b/setup_snapshot.sh index 4f198c5c..95e0a995 100755 --- a/setup_snapshot.sh +++ b/setup_snapshot.sh @@ -70,8 +70,9 @@ esac # other tools using $RUNNER_TEMP) don't collide. An empty directory also keeps # "gh run download" and the Windows rename below working on repeat calls. # $RUNNER_TEMP is emptied at the beginning and end of each job, so it needs no -# manual cleanup. See: -# https://docs.github.com/en/actions/reference/workflows-and-actions/variables +# manual cleanup. +# +# See https://docs.github.com/en/actions/reference/workflows-and-actions/variables tmpdir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" cd "$tmpdir" From a84029ebba0aa51d22db7515957f0f4cfccb2118 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 15 Jun 2026 15:58:57 +0200 Subject: [PATCH 4/5] Group $RUNNER_TEMP cleanup note with its docs link Co-authored-by: Isaac --- setup_release.sh | 7 ++++--- setup_snapshot.sh | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/setup_release.sh b/setup_release.sh index 285090ba..83980c39 100644 --- a/setup_release.sh +++ b/setup_release.sh @@ -39,10 +39,11 @@ ARM64) esac # Use a unique directory per invocation so repeated calls in the same job (and -# other tools using $RUNNER_TEMP) don't collide. $RUNNER_TEMP is emptied at the -# beginning and end of each job, so it needs no manual cleanup. +# other tools using $RUNNER_TEMP) don't collide. # -# See https://docs.github.com/en/actions/reference/workflows-and-actions/variables +# $RUNNER_TEMP is emptied at the beginning and end of each job, so it needs no +# manual cleanup; see +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables dir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" cd "$dir" diff --git a/setup_snapshot.sh b/setup_snapshot.sh index 95e0a995..3beb4cf3 100755 --- a/setup_snapshot.sh +++ b/setup_snapshot.sh @@ -69,10 +69,10 @@ esac # Use a unique directory per invocation so repeated calls in the same job (and # other tools using $RUNNER_TEMP) don't collide. An empty directory also keeps # "gh run download" and the Windows rename below working on repeat calls. -# $RUNNER_TEMP is emptied at the beginning and end of each job, so it needs no -# manual cleanup. # -# See https://docs.github.com/en/actions/reference/workflows-and-actions/variables +# $RUNNER_TEMP is emptied at the beginning and end of each job, so it needs no +# manual cleanup; see +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables tmpdir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" cd "$tmpdir" From 309a1acfd852a22e71d4307a5e8a6e8605d8b226 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 15 Jun 2026 16:39:07 +0200 Subject: [PATCH 5/5] Tidy $RUNNER_TEMP comment flow in setup scripts Drop the gh-run-download/Windows-rename aside from the snapshot comment and fold the $RUNNER_TEMP cleanup note back into the main paragraph in both scripts. Co-authored-by: Isaac --- setup_release.sh | 6 ++---- setup_snapshot.sh | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/setup_release.sh b/setup_release.sh index 83980c39..ed21b691 100644 --- a/setup_release.sh +++ b/setup_release.sh @@ -39,10 +39,8 @@ ARM64) esac # Use a unique directory per invocation so repeated calls in the same job (and -# other tools using $RUNNER_TEMP) don't collide. -# -# $RUNNER_TEMP is emptied at the beginning and end of each job, so it needs no -# manual cleanup; see +# other tools using $RUNNER_TEMP) don't collide. $RUNNER_TEMP is emptied at the +# beginning and end of each job, so it needs no manual cleanup; see # https://docs.github.com/en/actions/reference/workflows-and-actions/variables dir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" cd "$dir" diff --git a/setup_snapshot.sh b/setup_snapshot.sh index 3beb4cf3..6f70e73e 100755 --- a/setup_snapshot.sh +++ b/setup_snapshot.sh @@ -67,11 +67,8 @@ macOS) esac # Use a unique directory per invocation so repeated calls in the same job (and -# other tools using $RUNNER_TEMP) don't collide. An empty directory also keeps -# "gh run download" and the Windows rename below working on repeat calls. -# -# $RUNNER_TEMP is emptied at the beginning and end of each job, so it needs no -# manual cleanup; see +# other tools using $RUNNER_TEMP) don't collide. $RUNNER_TEMP is emptied at the +# beginning and end of each job, so it needs no manual cleanup; see # https://docs.github.com/en/actions/reference/workflows-and-actions/variables tmpdir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" cd "$tmpdir"