Skip to content

Commit 28f71b7

Browse files
committed
Avoid using the working directory
1 parent 294b8d7 commit 28f71b7

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

action.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,30 @@ inputs:
88
runs:
99
using: "composite"
1010
steps:
11+
- name: Set up cache paths
12+
id: cache-paths
13+
shell: bash
14+
run: |
15+
if [[ "$RUNNER_OS" == "Windows" ]]; then
16+
echo "setupsbt_path=D:/a/_setupsbt" >> $GITHUB_OUTPUT
17+
else
18+
echo "setupsbt_path=/home/runner/work/_setupsbt" >> $GITHUB_OUTPUT
19+
fi
20+
1121
- name: Cache sbt distribution
1222
id: cache-dir
1323
uses: actions/cache@v4
1424
with:
15-
path: setupsbt
25+
path: ${{ steps.cache-paths.outputs.setupsbt_path }}
1626
key: ${{ runner.os }}-sbt-${{ inputs.sbt-runner-version }}
1727

1828
- name: "Install sbt"
1929
shell: bash
2030
if: steps.cache-dir.outputs.cache-hit != 'true'
2131
run: |
22-
mkdir -p setupsbt
23-
curl -sL https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip > setupsbt/sbt-$SBT_RUNNER_VERSION.zip
24-
pushd setupsbt
32+
mkdir -p "${{ steps.cache-paths.outputs.setupsbt_path }}"
33+
curl -sL https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip > "${{ steps.cache-paths.outputs.setupsbt_path }}/sbt-$SBT_RUNNER_VERSION.zip"
34+
pushd "${{ steps.cache-paths.outputs.setupsbt_path }}"
2535
unzip -o "sbt-$SBT_RUNNER_VERSION.zip"
2636
popd
2737
env:
@@ -30,7 +40,7 @@ runs:
3040
- name: "Setup PATH"
3141
shell: bash
3242
run: |
33-
pushd setupsbt
43+
pushd "${{ steps.cache-paths.outputs.setupsbt_path }}"
3444
ls sbt/bin/sbt
3545
echo "$PWD/sbt/bin" >> "$GITHUB_PATH"
3646
popd

0 commit comments

Comments
 (0)