Skip to content

Commit a6c16a7

Browse files
Better error handling for GitHub API
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 8ee607c commit a6c16a7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/lint-js-and-ruby.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ jobs:
7878
git fetch origin ${{ github.event.pull_request.base.sha }}
7979
if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q '^.github/workflows'; then
8080
echo "changed=true" >> "$GITHUB_OUTPUT"
81-
actionlint_version=$(curl -s https://api.github.com/repos/rhysd/actionlint/releases/latest | jq -r .tag_name)
81+
response=$(curl -sf https://api.github.com/repos/rhysd/actionlint/releases/latest)
82+
if [ $? -eq 0 ]; then
83+
actionlint_version=$(echo "$response" | jq -r .tag_name)
84+
if [ -z "$actionlint_version" ]; then
85+
echo "Failed to parse Actionlint version"
86+
exit 1
87+
fi
88+
else
89+
echo "Failed to fetch latest Actionlint version"
90+
exit 1
91+
fi
8292
echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT"
8393
fi
8494
- name: Setup Actionlint

0 commit comments

Comments
 (0)