Skip to content

Commit e862b71

Browse files
authored
Merge pull request #25 from OP3ratordec/main
chore: update masking-3
2 parents 42b753b + 4601e00 commit e862b71

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ jobs:
6363
CHANGED_FILE="masking/data-classification.json"
6464
echo "Processing: $CHANGED_FILE"
6565
66-
response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/settings/bb.workspace.data-classification?allow_missing=true" \
66+
response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/settings/bb.workspace.data-classification" \
6767
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
6868
--header "Content-Type: application/json" \
6969
--data @"$CHANGED_FILE")
7070
71-
# Extract status code and response body
71+
# Extract status code and response body
7272
status_code=$(echo "$response" | tail -n1)
7373
body=$(echo "$response" | sed '$d')
7474
@@ -84,13 +84,13 @@ jobs:
8484
8585
- name: Apply global masking rule
8686
id: apply-global-masking-rule
87-
if: ${{ steps.changed-files.outputs.any_changed == 'true' && contains(steps.changed-files.outputs.all_changed_files, '/global-masking-rule.json') }}
87+
if: ${{ steps.changed-files.outputs.any_changed == 'true' && contains(steps.changed-files.outputs.all_changed_files, 'global-masking-rule.json') }}
8888
run: |
8989
# Process all global-masking-rule.json files
9090
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep "global-masking-rule.json" | while read -r CHANGED_FILE; do
9191
echo "Processing: $CHANGED_FILE"
9292
93-
response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/settings/bb.workspace.global-masking-rule?allow_missing=true" \
93+
response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/policies/masking_rule?allow_missing=true&update_mask=payload" \
9494
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
9595
--header "Content-Type: application/json" \
9696
--data @"$CHANGED_FILE")
@@ -103,11 +103,14 @@ jobs:
103103
echo "Response body: $body"
104104
105105
# Append to outputs (with unique identifiers)
106-
echo "${body}" >> $GITHUB_OUTPUT
107-
echo "EOF" >> $GITHUB_OUTPUT
108-
109-
if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
106+
if [[ $status_code -ge 200 && $status_code -lt 300 ]]; then
107+
echo "${body}" >> $GITHUB_OUTPUT
108+
else
110109
echo "Failed with status code: $status_code"
110+
echo "Response body: ${body}"
111+
if [[ $status_code -eq 403 ]]; then
112+
echo "Access denied. Please check your permissions and API token."
113+
fi
111114
exit 1
112115
fi
113116
done
@@ -119,7 +122,7 @@ jobs:
119122
with:
120123
script: |
121124
const changedFiles = process.env.CHANGED_FILES || '';
122-
let commentBody = `### Masking Policy Update 2 Summary\n\n`;
125+
let commentBody = `### Masking Policy Update 3 Summary\n\n`;
123126
124127
// Add status of merge
125128
commentBody += `✅ **PR Status:** Merged\n\n`;

0 commit comments

Comments
 (0)