@@ -86,31 +86,29 @@ jobs:
8686 id : apply-global-masking-rule
8787 if : ${{ steps.changed-files.outputs.any_changed == 'true' && contains(steps.changed-files.outputs.all_changed_files, 'global-masking-rule.json') }}
8888 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")
10896
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
114112
115113 - name : Comment on PR
116114 uses : actions/github-script@v7
@@ -138,19 +136,13 @@ jobs:
138136 let apiCallsFound = false;
139137
140138 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) {
149141 apiCallsFound = true;
150142 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+ }
154146
155147 if (changedFiles.includes('global-masking-rule.json')) {
156148 const status = ${{ toJSON(steps.apply-global-masking-rule.outputs) }}.status_code;
0 commit comments