Skip to content

Commit 3e1e002

Browse files
committed
Fix support for matching nightly-6.1 to 6.1-SNAPSHOT
1 parent 2d0ff58 commit 3e1e002

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,29 +142,29 @@ runs:
142142
SWIFT_VERSION=${{ inputs.swift-version }}
143143
144144
# try to match versions like 6.0.3, 6.1, 6, nightly-6.1, snapshot, and latest
145-
# note the "cat … | { grep PATTERN || true }" technique so we don't error out if we don't match
145+
# note the "cat … | ( grep PATTERN || true )" technique so we don't error out if we don't match
146146
# since we have a nicer error message below when the pattern is unmatched
147147
if [[ "${SWIFT_VERSION}" == 'latest' ]]; then
148148
# translate swift-version "latest" into our known latest version
149149
#LATEST_RELEASE="6.0.3"
150150
#SWIFT_VERSION="${LATEST_RELEASE}"
151151
# use the latest non-snapshot release
152-
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | grep -v -- '-SNAPSHOT' | head -n 1)
152+
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | ( grep -v -- '-SNAPSHOT' || true ) | head -n 1)
153153
elif [[ "${SWIFT_VERSION}" == 'snapshot' ]]; then
154154
#LATEST_SNAPSHOT="6.1-DEVELOPMENT-SNAPSHOT-2025-03-07-a"
155155
#SWIFT_VERSION="${LATEST_SNAPSHOT}"
156156
# use the latest snapshot release
157-
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | grep -- '-SNAPSHOT' | head -n 1)
157+
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | ( grep -- '-SNAPSHOT' || true ) | head -n 1)
158158
elif [[ "${SWIFT_VERSION}" == nightly-* ]]; then
159159
echo "Checking nightly build for: ${SWIFT_VERSION}"
160160
# e.g., nightly-6.1 will match 6.1-DEVELOPMENT-SNAPSHOT-*
161161
SWIFT_VERSION=$(echo ${SWIFT_VERSION} | sed 's;nightly-;;g')
162-
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | grep -- "${SWIFT_VERSION}-DEVELOPMENT-SNAPSHOT" | head -n 1)
162+
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | ( grep -- "${SWIFT_VERSION}-DEVELOPMENT-SNAPSHOT" || true ) | head -n 1)
163163
echo "Found nightly build: ${SWIFT_VERSION}"
164164
else
165165
# match "6.0" to "6.0.3"
166166
# match "6.1" to "6.1-DEVELOPMENT-SNAPSHOT-2025-03-07-a"
167-
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | grep -- "^${SWIFT_VERSION}" | head -n 1)
167+
SWIFT_VERSION=$(cat ${SWIFT_VERSIONS_FILE} | ( grep -- "^${SWIFT_VERSION}" || true ) | head -n 1)
168168
fi
169169
170170
if [[ "${SWIFT_VERSION}" == "" ]]; then

0 commit comments

Comments
 (0)