Skip to content

Commit 13f897b

Browse files
committed
chore: update compiled workflows via e2e.sh
1 parent 6426ec3 commit 13f897b

3 files changed

Lines changed: 224 additions & 410 deletions

File tree

clean.sh

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
#
88
# This script will:
99
# 1. Close all open issues with cleanup comment
10-
# 2. Close all open pull requests with cleanup comment
11-
# 3. Delete test branches matching specific patterns
12-
# 4. Provide detailed logging of all cleanup operations
10+
# 2. Close all open pull requests with cleanup comment
11+
# 3. Close all open discussions
12+
# 4. Delete test branches matching specific patterns
13+
# 5. Provide detailed logging of all cleanup operations
1314

1415
# Colors for output
1516
RED='\033[0;31m'
@@ -48,6 +49,7 @@ cleanup_test_resources() {
4849
info "Cleaning up test resources..."
4950
local issues_closed=0
5051
local prs_closed=0
52+
local discussions_closed=0
5153
local branches_deleted=0
5254

5355
# Close all issues
@@ -76,6 +78,27 @@ cleanup_test_resources() {
7678
fi
7779
done < <(gh pr list --limit 20 --json number --jq '.[].number' 2>/dev/null || true)
7880

81+
# Close all discussions
82+
info "Checking for open discussions to close..."
83+
while read -r discussion_id; do
84+
if [[ -n "$discussion_id" ]]; then
85+
# Close discussion using GraphQL mutation
86+
local mutation="mutation {
87+
closeDiscussion(input: {discussionId: \"$discussion_id\"}) {
88+
discussion {
89+
number
90+
}
91+
}
92+
}"
93+
if gh api graphql -f query="$mutation" &>/dev/null; then
94+
info "Closed discussion with ID $discussion_id"
95+
((discussions_closed++))
96+
else
97+
warning "Failed to close discussion with ID $discussion_id"
98+
fi
99+
fi
100+
done < <(gh api repos/:owner/:repo/discussions --paginate --jq '.[] | select(.closed == false) | .id' 2>/dev/null || true)
101+
79102
# Delete test branches
80103
info "Checking for test branches to delete..."
81104
while read -r branch; do
@@ -89,7 +112,7 @@ cleanup_test_resources() {
89112
fi
90113
done < <(git branch -r 2>/dev/null | grep 'origin/test-pr-\|origin/claude-test-branch\|origin/codex-test-branch' | sed 's/origin\///' || true)
91114

92-
success "Cleanup completed: $issues_closed issues closed, $prs_closed PRs closed, $branches_deleted branches deleted"
115+
success "Cleanup completed: $issues_closed issues closed, $prs_closed PRs closed, $discussions_closed discussions closed, $branches_deleted branches deleted"
93116
}
94117

95118
main() {

0 commit comments

Comments
 (0)