Skip to content

Commit 05ff73c

Browse files
committed
Improve could not find asset reporting
1 parent 98f8398 commit 05ff73c

File tree

2 files changed

+44
-19
lines changed

2 files changed

+44
-19
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ jobs:
9494
destination: bin/extra/jq
9595
add-to-path: 1
9696

97+
- name: no releases
98+
id: no-releases
99+
continue-on-error: true
100+
uses: ./action
101+
with:
102+
repository: check-spelling/.github
103+
trace: 1
104+
97105
- name: check add to path
98106
shell: bash
99107
run: |

gh-program-downloader

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,48 @@ find_artifact() {
7373
arch_re='(?:i[3-6]|x)86';;
7474
esac
7575
fi
76-
os_re="$os_re" arch_re="$arch_re" version_selector="$version_selector" \
76+
artifact=$(
77+
os_re="$os_re" arch_re="$arch_re" version_selector="$version_selector" \
7778
"$GITHUB_ACTION_PATH/program-filter" "$releases"
79+
)
7880
}
7981

8082
select_artifact() {
81-
artifact=$(find_artifact)
82-
if [ -z "$artifact" ]; then
83-
if [ -n "$os_re" ]; then
84-
os_message="OS ('$os_re')"
85-
maybe_and=1
86-
matching=1
87-
fi
88-
if [ -n "$arch_re" ]; then
89-
arch_message="ARCH ('$arch_re')"
90-
if [ -n "$maybe_and" ]; then
91-
and=' and '
92-
fi
93-
matching=1
94-
fi
95-
if [ -n "$matching" ]; then
96-
matching='matching '
83+
find_artifact
84+
if [ -n "$artifact" ]; then
85+
return
86+
fi
87+
88+
q='`'
89+
if [ -n "$os_re" ]; then
90+
os_message="OS ($q$os_re$q)"
91+
maybe_and=1
92+
matching=1
93+
fi
94+
if [ -n "$arch_re" ]; then
95+
arch_message="arch ($q$arch_re$q)"
96+
if [ -n "$maybe_and" ]; then
97+
and=' and '
9798
fi
98-
echo "$0 could not find asset from '$releases_url' (saved as '$releases') ${matching}${os_message}${and}${arch_message}" >&2
99-
exit 1
99+
matching=1
100+
fi
101+
if [ -n "$matching" ]; then
102+
matching='for a release matching '
100103
fi
104+
if [ -n "$version_selector" ]; then
105+
version_selector_message=" using version selector: $q$version_selector$q"
106+
fi
107+
(
108+
echo "## Asset not found in release"
109+
echo
110+
echo "Checked $releases_url ${matching}${os_message}${and}${arch_message}${version_selector_message} with release content:"
111+
echo
112+
echo '```json'
113+
cat "$releases"
114+
echo
115+
echo '```'
116+
) | tee -a "$GITHUB_STEP_SUMMARY" >&2
117+
exit 1
101118
}
102119

103120
set_up_auth() {

0 commit comments

Comments
 (0)