Skip to content

Commit 035099f

Browse files
committed
prevent download errors from failing the workflow
1 parent 5ecbeeb commit 035099f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

stash/restore/action.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,21 @@ runs:
137137
REPO: "${{ github.repository }}"
138138
STASH_DIR: "${{ steps.mung.outputs.stash_path }}"
139139
run: |
140-
gh run download $STASH_RUN_ID --name $STASH_NAME --dir "$STASH_DIR" -R "$REPO"
141-
echo "Succesfully restored stash $STASH_NAME."
140+
# Catch errors in the download with || to avoid the whole workflow failing
141+
# when the download times out
142+
gh run download "$STASH_RUN_ID" \
143+
--name "$STASH_NAME" \
144+
--dir "$STASH_DIR" \
145+
-R "$REPO" || download="failed" && download="success"
142146
147+
echo "download=$download" >> "$GITHUB_OUTPUT"
143148
144149
- name: Set stash-hit Output
145150
id: output
146-
if: ${{ ! cancelled() && steps.check-deps.conclusion == 'success' }}
151+
if: ${{ ! cancelled() && steps.check-deps.conclusion == 'success'}}
147152
shell: bash
148153
run: |
149-
if [ "${{ steps.download.conclusion }}" == "success" ]; then
154+
if [ "${{ steps.download.outputs.download }}" == "success" ]; then
150155
echo "stash-hit=true" >> $GITHUB_OUTPUT
151156
else
152157
echo "stash-hit=false" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)