@@ -60,31 +60,27 @@ jobs:
60
60
id : apply-masking-algorithm
61
61
if : ${{ steps.changed-files.outputs.any_changed == 'true' && contains(steps.changed-files.outputs.all_changed_files, 'masking-algorithm.json') }}
62
62
run : |
63
- # Process all masking-algorithm.json files
64
- echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep "masking-algorithm.json" | while read -r CHANGED_FILE; do
65
- echo "Processing: $CHANGED_FILE"
66
-
67
- response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/settings/bb.workspace.masking-algorithm?allow_missing=true" \
68
- --header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
69
- --header "Content-Type: application/json" \
70
- --data @"$CHANGED_FILE")
63
+ CHANGED_FILE="masking/masking-algorithm.json"
64
+ echo "Processing: $CHANGED_FILE"
65
+
66
+ response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/settings/bb.workspace.masking-algorithm?allow_missing=true" \
67
+ --header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
68
+ --header "Content-Type: application/json" \
69
+ --data @"$CHANGED_FILE")
71
70
72
- # Extract status code and response body
73
- status_code=$(echo "$response" | tail -n1)
74
- body=$(echo "$response" | sed '$d')
75
- echo "Status code: $status_code"
76
- echo "Response body: $body"
77
-
78
- # Append to outputs (with unique identifiers)
79
- echo "status_code=${status_code}" >> $GITHUB_OUTPUT
80
- echo $body >> $GITHUB_OUTPUT
81
- echo "EOF" >> $GITHUB_OUTPUT
82
-
83
- if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
84
- echo "Failed with status code: $status_code"
85
- exit 1
86
- fi
87
- done
71
+ # Extract status code and response body
72
+ status_code=$(echo "$response" | tail -n1)
73
+ body=$(echo "$response" | sed '$d')
74
+
75
+ echo "status_code=${status_code}" >> $GITHUB_OUTPUT
76
+ echo "response_body<<EOF" >> $GITHUB_OUTPUT
77
+ echo "${body}" >> $GITHUB_OUTPUT
78
+ echo "EOF" >> $GITHUB_OUTPUT
79
+
80
+ if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
81
+ echo "Failed with status code: $status_code"
82
+ exit 1
83
+ fi
88
84
89
85
- name : Apply semantic type
90
86
id : apply-semantic-type
@@ -142,18 +138,12 @@ jobs:
142
138
let apiCallsFound = false;
143
139
144
140
if (changedFiles.includes('masking-algorithm.json')) {
145
- const maskingStatuses = Object.keys(${{ toJSON(steps.apply-masking-algorithm.outputs) }} || {})
146
- .filter(key => key.startsWith('status_code_'))
147
- .map(key => ({
148
- name: key.replace('status_code_', ''),
149
- status: ${{ toJSON(steps.apply-masking-algorithm.outputs) }}[key]
150
- }));
151
-
152
- maskingStatuses.forEach(({name, status}) => {
141
+ const status = ${{ toJSON(steps.apply-masking-algorithm.outputs) }}.status_code;
142
+ if (status) {
153
143
apiCallsFound = true;
154
144
const success = status >= 200 && status < 300;
155
- commentBody += `- Column Masking (${name}) : ${success ? '✅' : '❌'} ${status}\n`;
156
- });
145
+ commentBody += `- Column Masking: ${success ? '✅' : '❌'} ${status}\n`;
146
+ }
157
147
}
158
148
159
149
if (changedFiles.includes('semantic-type.json')) {
0 commit comments