@@ -88,34 +88,29 @@ jobs:
88
88
id : apply-global-masking-rule
89
89
if : ${{ steps.changed-files.outputs.any_changed == 'true' && contains(steps.changed-files.outputs.all_changed_files, 'global-masking-rule-classification.json') }}
90
90
run : |
91
- # Process all global-masking-rule-classification.json files
92
- echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep "global-masking-rule-classification.json" | while read -r CHANGED_FILE; do
93
- echo "Processing: $CHANGED_FILE"
94
-
95
- response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/policies/masking_rule?allow_missing=true&update_mask=payload" \
96
- --header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
97
- --header "Content-Type: application/json" \
98
- --data @"$CHANGED_FILE")
99
-
100
- # Extract status code and response body
101
- status_code=$(echo "$response" | tail -n1)
102
- body=$(echo "$response" | sed '$d')
103
-
104
- echo "Status code: $status_code"
105
- echo "Response body: $body"
106
-
107
- # Append to outputs (with unique identifiers)
108
- if [[ $status_code -ge 200 && $status_code -lt 300 ]]; then
109
- echo "${body}" >> $GITHUB_OUTPUT
110
- else
111
- echo "Failed with status code: $status_code"
112
- echo "Response body: ${body}"
113
- if [[ $status_code -eq 403 ]]; then
114
- echo "Access denied. Please check your permissions and API token."
115
- fi
116
- exit 1
117
- fi
118
- done
91
+ CHANGED_FILE="masking/global-masking-rule-classification.json"
92
+ echo "Processing: $CHANGED_FILE"
93
+
94
+ response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/policies/masking_rule?allow_missing=true&update_mask=payload" \
95
+ --header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
96
+ --data @"$CHANGED_FILE")
97
+
98
+ # Extract status code and response body
99
+ status_code=$(echo "$response" | tail -n1)
100
+ body=$(echo "$response" | sed '$d')
101
+
102
+ echo "status_code=${status_code}" >> $GITHUB_OUTPUT
103
+ echo "response_body<<EOF" >> $GITHUB_OUTPUT
104
+ echo "${body}" >> $GITHUB_OUTPUT
105
+ echo "EOF" >> $GITHUB_OUTPUT
106
+
107
+ echo "status_code=${status_code}"
108
+ echo "response_body=${body}"
109
+
110
+ if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
111
+ echo "Failed with status code: $status_code"
112
+ exit 1
113
+ fi
119
114
120
115
- name : Apply column masking policy
121
116
id : apply-column-masking
0 commit comments