From 1fa6704c0b3b58225fddd5b86603bef12d2d6e04 Mon Sep 17 00:00:00 2001
From: adela
Date: Fri, 10 Jan 2025 11:14:19 +0800
Subject: [PATCH 1/2] select
---
.../databases/hr_prod/202501101116_select_employee.sql | 1 +
1 file changed, 1 insertion(+)
create mode 100644 export/projects/sample-project/databases/hr_prod/202501101116_select_employee.sql
diff --git a/export/projects/sample-project/databases/hr_prod/202501101116_select_employee.sql b/export/projects/sample-project/databases/hr_prod/202501101116_select_employee.sql
new file mode 100644
index 0000000..99ff170
--- /dev/null
+++ b/export/projects/sample-project/databases/hr_prod/202501101116_select_employee.sql
@@ -0,0 +1 @@
+SELECT * FROM employee;
\ No newline at end of file
From 82634b323f11d9ee7fed1ba08389a85ad189e0e7 Mon Sep 17 00:00:00 2001
From: adela
Date: Fri, 10 Jan 2025 11:17:17 +0800
Subject: [PATCH 2/2] fix
---
.github/workflows/bb-export.yml | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/bb-export.yml b/.github/workflows/bb-export.yml
index 98a26ac..b199add 100644
--- a/.github/workflows/bb-export.yml
+++ b/.github/workflows/bb-export.yml
@@ -55,9 +55,9 @@ jobs:
echo "URL: $url"
echo "Method: $method"
- # Store response in a temporary file to avoid string manipulation issues
- local temp_file=$(mktemp)
- local http_code=$(curl -s -w "%{http_code}" \
+ # Store response in a temporary file
+ temp_file=$(mktemp)
+ http_code=$(curl -s -w "%{http_code}" \
--request "$method" "$url" \
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
--header "Content-Type: application/json" \
@@ -77,15 +77,16 @@ jobs:
fi
# Validate JSON response
- if ! python3 -c "
+ if ! python3 << 'EOF'
import sys, json
try:
- with open('$temp_file', 'r') as f:
+ with open(sys.argv[1], 'r') as f:
json.load(f)
except json.JSONDecodeError as e:
print(f'Invalid JSON: {str(e)}', file=sys.stderr)
sys.exit(1)
-" 2>/dev/null; then
+EOF
+ "$temp_file" 2>/dev/null; then
echo "Error: Invalid JSON response"
rm "$temp_file"
return 1