Skip to content

Commit 773da98

Browse files
committed
Use runner.temp for transient file storage
1 parent a80a9af commit 773da98

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

action.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ runs:
136136
#LATEST_RELEASE=$(curl -fsSL -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" --retry 10 --retry-max-time 600 https://api.github.com/repos/skiptools/swift-android-toolchain/releases/latest | jq -r '.tag_name')
137137
138138
# fetch the Atom feed for the latest releases
139-
curl -fsSL --retry 8 --retry-connrefused https://github.com/skiptools/swift-android-toolchain/releases.atom --output ~/swift-releases.xml
140-
yq -oy '.feed.entry[].title' ~/swift-releases.xml | sort -rn > ~/swift-versions.txt
139+
curl -fsSL --retry 8 --retry-connrefused https://github.com/skiptools/swift-android-toolchain/releases.atom --output ${{ runner.temp }}/swift-releases.xml
140+
SWIFT_VERSIONS_FILE=${{ runner.temp }}/swift-versions.txt
141+
yq -oy '.feed.entry[].title' ${{ runner.temp }}/swift-releases.xml | sort -rn > ${SWIFT_VERSIONS_FILE}
141142
142143
# if we hardcode the latest builds, we would need to update them every time a new snapshot is released
143144
@@ -148,20 +149,20 @@ runs:
148149
#LATEST_RELEASE="6.0.3"
149150
#SWIFT_VERSION="${LATEST_RELEASE}"
150151
# use the latest non-snapshot release
151-
SWIFT_VERSION=$(cat ~/swift-versions.txt | grep -v -- '-SNAPSHOT' | head -n 1)
152+
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | grep -v -- '-SNAPSHOT' | head -n 1)
152153
elif [[ "${SWIFT_VERSION}" == 'snapshot' ]]; then
153154
#LATEST_SNAPSHOT="6.1-DEVELOPMENT-SNAPSHOT-2025-03-07-a"
154155
#SWIFT_VERSION="${LATEST_SNAPSHOT}"
155156
# use the latest snapshot release
156-
SWIFT_VERSION=$(cat ~/swift-versions.txt | grep -- '-SNAPSHOT' | head -n 1)
157+
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | grep -- '-SNAPSHOT' | head -n 1)
157158
elif [[ "${SWIFT_VERSION}" == nightly-* ]]; then
158159
# e.g., nightly-6.1 will match 6.1-DEVELOPMENT-SNAPSHOT-*
159160
SWIFT_VERSION=$(echo ${SWIFT_VERSION} | sed 's;nightly-;;g')
160-
SWIFT_VERSION=$(cat ~/swift-versions.txt | grep -- "${SWIFT_VERSION}-SNAPSHOT" | head -n 1)
161+
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | grep -- "${SWIFT_VERSION}-SNAPSHOT" | head -n 1)
161162
else
162163
# match "6.0" to "6.0.3"
163164
# match "6.1" to "6.1-DEVELOPMENT-SNAPSHOT-2025-03-07-a"
164-
SWIFT_VERSION=$(cat ~/swift-versions.txt | grep -- "^${SWIFT_VERSION}" | head -n 1)
165+
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | grep -- "^${SWIFT_VERSION}" | head -n 1)
165166
fi
166167
167168
if [[ "${SWIFT_VERSION}" == "" ]]; then
@@ -207,15 +208,15 @@ runs:
207208
uses: actions/cache@v4
208209
id: cache-swift
209210
with:
210-
path: ~/swift-download
211+
path: ${{ runner.temp }}/swift-download
211212
key: "swift-${{ steps.setup.outputs.swift-version }}-${{ steps.setup.outputs.osid }}"
212213

213214
- name: Download Swift Host Toolchain
214215
if: steps.cache-swift.outputs.cache-hit != 'true'
215216
shell: bash
216217
run: |
217-
mkdir -p ~/swift-download
218-
cd ~/swift-download
218+
mkdir -p ${{ runner.temp }}/swift-download
219+
cd ${{ runner.temp }}/swift-download
219220
BASE_URL="https://download.swift.org/${{ steps.setup.outputs.swift-branch }}"
220221
221222
if [ ${RUNNER_OS} == 'Linux' ]; then
@@ -234,7 +235,7 @@ runs:
234235
- name: Install Swift Host Toolchain
235236
shell: bash
236237
run: |
237-
cd ~/swift-download
238+
cd ${{ runner.temp }}/swift-download
238239
if [ ${RUNNER_OS} == 'Linux' ]; then
239240
mkdir -p ${HOME}/swift/toolchains/${{ steps.setup.outputs.swift-id }}
240241
tar -xzf swift.tar.gz -C ${HOME}/swift/toolchains/${{ steps.setup.outputs.swift-id }} --strip 1

0 commit comments

Comments
 (0)