File tree 1 file changed +14
-7
lines changed
1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 19
19
# some notification types like ci-activity do not provide a thread
20
20
github_url=" https://github.com/notifications?query=is%3Aunread"
21
21
else
22
- github_url=$(
23
- curl -sL -H " Accept: application/vnd.github+json" \
24
- -H " Authorization: Bearer $GITHUB_TOKEN " \
25
- -H " X-GitHub-Api-Version: 2022-11-28" \
26
- " $api_url " |
27
- grep --max-count=1 ' "html_url"' | cut -d ' "' -f 4 # skip `jq` dependency
28
- )
22
+ response=$( curl -sL -H " Accept: application/vnd.github+json" \
23
+ -H " Authorization: Bearer $GITHUB_TOKEN " \
24
+ -H " X-GitHub-Api-Version: 2022-11-28" \
25
+ " $api_url " )
26
+ # using `grep` here avoids `jq` dependency
27
+ github_url=$( echo " $response " | grep --max-count=1 ' "html_url"' | cut -d ' "' -f4)
28
+
29
+ # VALIDATE
30
+ if [[ -z " $github_url " ]]; then
31
+ err_msg=" ERROR: could not get url to open. Check debugging log"
32
+ echo -n " $err_msg " # pass for Alfred notification
33
+ print " $err_msg \nGithub response: $response " >&2 # pass to console
34
+ return 1
35
+ fi
29
36
fi
30
37
31
38
if [[ " $mode " == " open" ]]; then
You can’t perform that action at this time.
0 commit comments