Skip to content

Commit 00be32e

Browse files
Merge pull request #18 from bytebase/a-branch-4
test
2 parents d38c2f2 + ee85b17 commit 00be32e

File tree

2 files changed

+25
-35
lines changed

2 files changed

+25
-35
lines changed

.github/workflows/bb-masking-2.yml

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -60,31 +60,27 @@ jobs:
6060
id: apply-masking-algorithm
6161
if: ${{ steps.changed-files.outputs.any_changed == 'true' && contains(steps.changed-files.outputs.all_changed_files, 'masking-algorithm.json') }}
6262
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")
7170
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
8884
8985
- name: Apply semantic type
9086
id: apply-semantic-type
@@ -142,18 +138,12 @@ jobs:
142138
let apiCallsFound = false;
143139
144140
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) {
153143
apiCallsFound = true;
154144
const success = status >= 200 && status < 300;
155-
commentBody += `- Column Masking (${name}): ${success ? '✅' : '❌'} ${status}\n`;
156-
});
145+
commentBody += `- Column Masking: ${success ? '✅' : '❌'} ${status}\n`;
146+
}
157147
}
158148
159149
if (changedFiles.includes('semantic-type.json')) {

masking/masking-algorithm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"id": "9347822e-5a4a-4797-85ed-a59bb3115622",
88
"title": "md5-mask",
9-
"description": "i am md5-mask",
9+
"description": "iii am md5-mask",
1010
"category": "HASH",
1111
"md5Mask": {
1212
"salt": "salt"

0 commit comments

Comments
 (0)