Skip to content

Commit e3e0659

Browse files
Merge pull request #94 from bytebase/a-branch-24
update
2 parents d712eeb + 871d780 commit e3e0659

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Diff for: .github/workflows/4-bb-export.yml

+19
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ jobs:
100100
-d "{\"title\":\"\",\"content\":\"$SQL_CONTENT\",\"type\":\"TYPE_SQL\",\"source\":\"SOURCE_BYTEBASE_ARTIFACT\",\"visibility\":\"VISIBILITY_PUBLIC\"}")
101101
102102
SHEET_NAME=$(echo "$sheet_response" | jq -r '.name')
103+
if [ -z "$SHEET_NAME" ] || [ "$SHEET_NAME" = "null" ]; then
104+
echo "Error creating sheet. Response: $sheet_response"
105+
exit 1
106+
fi
103107
echo "Sheet created: $SHEET_NAME"
104108
105109
# Create Plan
@@ -109,7 +113,12 @@ jobs:
109113
-H "Content-Type: application/json" \
110114
-d "{\"steps\":[{\"specs\":[{\"id\":\"$STEP_ID\",\"export_data_config\":{\"target\":\"/instances/$INSTANCE/databases/$DATABASE\",\"format\":\"$FORMAT\",\"sheet\":\"$SHEET_NAME\"}}]}],\"title\":\"Export data from $DATABASE\",\"description\":\"EXPORT\"}")
111115
116+
echo "Plan response: $plan_response" # Debug output
112117
PLAN_NAME=$(echo "$plan_response" | jq -r '.name')
118+
if [ -z "$PLAN_NAME" ] || [ "$PLAN_NAME" = "null" ]; then
119+
echo "Error creating plan. Response: $plan_response"
120+
exit 1
121+
fi
113122
echo "Plan created: $PLAN_NAME"
114123
115124
# Create Issue
@@ -119,6 +128,11 @@ jobs:
119128
-H "Content-Type: application/json" \
120129
-d "{\"approvers\":[],\"approvalTemplates\":[],\"subscribers\":[],\"title\":\"Issue: Export data from instances/$INSTANCE/databases/$DATABASE\",\"description\":\"SQL request from GitHub\",\"type\":\"DATABASE_DATA_EXPORT\",\"assignee\":\"\",\"plan\":\"$PLAN_NAME\"}")
121130
131+
echo "Issue response: $issue_response" # Debug output
132+
if ! echo "$issue_response" | jq -e '.name' > /dev/null; then
133+
echo "Error creating issue. Response: $issue_response"
134+
exit 1
135+
fi
122136
ISSUE_NUMBER=$(echo "$issue_response" | jq -r '.name | split("/")[-1]')
123137
ISSUE_LINK="${{ secrets.BYTEBASE_URL }}/projects/$PROJECT/issues/$ISSUE_NUMBER"
124138
echo "Issue created: $ISSUE_LINK"
@@ -130,6 +144,11 @@ jobs:
130144
-H "Content-Type: application/json" \
131145
-d "{\"plan\":\"$PLAN_NAME\"}")
132146
147+
echo "Rollout response: $rollout_response" # Debug output
148+
if ! echo "$rollout_response" | jq -e '.name' > /dev/null; then
149+
echo "Error creating rollout. Response: $rollout_response"
150+
exit 1
151+
fi
133152
echo "Rollout created: $(echo "$rollout_response" | jq -r '.name')"
134153
done
135154

0 commit comments

Comments
 (0)