@@ -86,31 +86,29 @@ jobs:
86
86
id : apply-global-masking-rule
87
87
if : ${{ steps.changed-files.outputs.any_changed == 'true' && contains(steps.changed-files.outputs.all_changed_files, 'global-masking-rule.json') }}
88
88
run : |
89
- # Process all global-masking-rule.json files
90
- echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep "global-masking-rule.json" | while read -r CHANGED_FILE; do
91
- echo "Processing: $CHANGED_FILE"
92
-
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" \
94
- --header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
95
- --header "Content-Type: application/json" \
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"
103
- echo "Response body: $body"
104
-
105
- # Append to outputs (with unique identifiers)
106
- echo "${body}" >> $GITHUB_OUTPUT
107
- echo "EOF" >> $GITHUB_OUTPUT
89
+ CHANGED_FILE="masking/global-masking-rule.json"
90
+ echo "Processing: $CHANGED_FILE"
91
+
92
+ response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/policies/masking_rule?allow_missing=true&update_mask=payload" \
93
+ --header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
94
+ --header "Content-Type: application/json" \
95
+ --data @"$CHANGED_FILE")
108
96
109
- if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
110
- echo "Failed with status code: $status_code"
111
- exit 1
112
- fi
113
- done
97
+ # Extract status code and response body
98
+ status_code=$(echo "$response" | tail -n1)
99
+ body=$(echo "$response" | sed '$d')
100
+
101
+ echo "Status code: $status_code"
102
+ echo "Response body: $body"
103
+
104
+ # Append to outputs (with unique identifiers)
105
+ echo "${body}" >> $GITHUB_OUTPUT
106
+ echo "EOF" >> $GITHUB_OUTPUT
107
+
108
+ if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
109
+ echo "Failed with status code: $status_code"
110
+ exit 1
111
+ fi
114
112
115
113
- name : Comment on PR
116
114
uses : actions/github-script@v7
@@ -138,19 +136,13 @@ jobs:
138
136
let apiCallsFound = false;
139
137
140
138
if (changedFiles.includes('semantic-type.json')) {
141
- const semanticTypeStatuses = Object.keys(${{ toJSON(steps.apply-semantic-type.outputs) }} || {})
142
- .filter(key => key.startsWith('status_code_'))
143
- .map(key => ({
144
- name: key.replace('status_code_', ''),
145
- status: ${{ toJSON(steps.apply-semantic-type.outputs) }}[key]
146
- }));
147
-
148
- semanticTypeStatuses.forEach(({name, status}) => {
139
+ const status = ${{ toJSON(steps.apply-semantic-type.outputs) }}.status_code;
140
+ if (status) {
149
141
apiCallsFound = true;
150
142
const success = status >= 200 && status < 300;
151
- commentBody += `- Semantic Type (${name}) : ${success ? '✅' : '❌'} ${status}\n`;
152
- });
153
- }
143
+ commentBody += `- Semantic Type: ${success ? '✅' : '❌'} ${status}\n`;
144
+ }
145
+ }
154
146
155
147
if (changedFiles.includes('global-masking-rule.json')) {
156
148
const status = ${{ toJSON(steps.apply-global-masking-rule.outputs) }}.status_code;
0 commit comments