mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
Update close-discussion-on-pr.yaml
This commit is contained in:
parent
6ff815eed3
commit
1945fe288d
15
.github/workflows/close-discussion-on-pr.yaml
vendored
15
.github/workflows/close-discussion-on-pr.yaml
vendored
@ -30,14 +30,19 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for discussion_id in $discussion_ids; do
|
for discussion_id in $discussion_ids; do
|
||||||
echo "Closing discussion #$discussion_id"
|
echo "Attempting to close discussion #$discussion_id"
|
||||||
response=$(curl -s -o /dev/null -w "%{http_code}" -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
|
response=$(curl -s -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
|
||||||
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
-d '{"state": "closed"}' \
|
-d '{"state": "closed"}' \
|
||||||
"https://api.github.com/repos/${{ github.repository }}/discussions/$discussion_id")
|
"https://api.github.com/repos/${{ github.repository }}/discussions/$discussion_id")
|
||||||
|
|
||||||
if [ "$response" -ne 200 ]; then
|
if echo "$response" | jq -e '.id' > /dev/null; then
|
||||||
echo "Failed to close discussion #$discussion_id. HTTP status code: $response"
|
echo "Successfully closed discussion #$discussion_id"
|
||||||
exit 1
|
else
|
||||||
|
error_message=$(echo "$response" | jq -r '.message // "Unknown error"')
|
||||||
|
echo "Warning: Failed to close discussion #$discussion_id. Error: $error_message"
|
||||||
|
echo "Full response: $response"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
shell: bash
|
shell: bash
|
||||||
|
continue-on-error: true
|
Loading…
Reference in New Issue
Block a user