Skip to content

Commit 5fdc4c3

Browse files
authored
Update close-stale-issues.yml
troubleshooting
1 parent 1c0b72b commit 5fdc4c3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/close-stale-issues.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@ jobs:
2626
CUSTOM_MESSAGE: 'Appologies that we were unable to address this issue in a timely manner! Given that we have millions of free users this has been a challenge that we are working on over time. This issue is being closed in order to allow us to focus on resolving more recently active issues. If this issue is still meaningful, please feel free to comment an update and re-open the issue for troubleshooting! Thanks for your continued loyalty to the StackBlitz platform over the years!'
2727
run: |
2828
set -e # Stop the script if any command fails
29+
set -x # Echo each command before executing it
30+
2931
page=1
3032
while : ; do
3133
echo "Fetching page $page of issues..."
32-
# Fetch a page of issues with the specific label
33-
curl -s -H "Authorization: token $GITHUB_TOKEN" \
34+
response=$(curl -sS -H "Authorization: token $GITHUB_TOKEN" \
3435
-H "Accept: application/vnd.github.v3+json" \
35-
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues?state=open&labels=$LABEL_NAME&per_page=100&page=$page" \
36-
-o issues.json
36+
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues?state=open&labels=$LABEL_NAME&per_page=100&page=$page")
3737
38-
# Check for curl command success
38+
# Check if curl command succeeded
3939
if [ $? -ne 0 ]; then
4040
echo "Curl command failed."
4141
exit 1
4242
fi
4343
44+
# Write to issues.json file for jq processing
45+
echo $response > issues.json
46+
4447
# Exit loop if no issues are returned
4548
if [ $(jq length issues.json) -eq 0 ]; then
4649
echo "No more issues found."
@@ -50,7 +53,7 @@ jobs:
5053
echo "Closing issues..."
5154
# Close issues
5255
jq -c '.[] | .number' issues.json | while read -r issue; do
53-
RESPONSE=$(curl -s -w "%{http_code}" -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
56+
RESPONSE=$(curl -sS -w "%{http_code}" -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
5457
-H "Accept: application/vnd.github.v3+json" \
5558
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$issue" \
5659
-d "{\"state\": \"closed\", \"body\": \"$CUSTOM_MESSAGE\"}")

0 commit comments

Comments
 (0)