Skip to content

Commit e554a70

Browse files
committed
chore: update compiled workflows via e2e.sh
1 parent 31bf615 commit e554a70

1 file changed

Lines changed: 39 additions & 7 deletions

File tree

e2e.sh

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -518,13 +518,45 @@ create_test_discussion() {
518518
local body="$2"
519519
local category="${3:-General}"
520520

521-
# Create discussion using GitHub API since gh CLI might not support discussions create
522-
local discussion_data=$(gh api repos/:owner/:repo/discussions \
523-
--method POST \
524-
--field title="$title" \
525-
--field body="$body" \
526-
--field category_id="$(gh api repos/:owner/:repo/discussions/categories --jq '.[] | select(.name=="'$category'") | .id')" \
527-
2>/dev/null | jq -r '.number // empty' 2>/dev/null)
521+
# Get repository ID and category ID using GraphQL
522+
local repo_id=$(gh api graphql -f query='
523+
{
524+
repository(owner: "'$REPO_OWNER'", name: "'$REPO_NAME'") {
525+
id
526+
}
527+
}' --jq '.data.repository.id' 2>/dev/null)
528+
529+
local category_id=$(gh api graphql -f query='
530+
{
531+
repository(owner: "'$REPO_OWNER'", name: "'$REPO_NAME'") {
532+
discussionCategories(first: 10) {
533+
nodes {
534+
id
535+
name
536+
}
537+
}
538+
}
539+
}' --jq '.data.repository.discussionCategories.nodes[] | select(.name=="'$category'") | .id' 2>/dev/null)
540+
541+
if [[ -z "$repo_id" || -z "$category_id" ]]; then
542+
echo ""
543+
return
544+
fi
545+
546+
# Create discussion using GraphQL mutation
547+
local discussion_data=$(gh api graphql -f query='
548+
mutation {
549+
createDiscussion(input: {
550+
repositoryId: "'$repo_id'"
551+
categoryId: "'$category_id'"
552+
title: "'$title'"
553+
body: "'$body'"
554+
}) {
555+
discussion {
556+
number
557+
}
558+
}
559+
}' --jq '.data.createDiscussion.discussion.number // empty' 2>/dev/null)
528560

529561
if [[ -n "$discussion_data" ]]; then
530562
echo "$discussion_data"

0 commit comments

Comments
 (0)