FANNG1 commented on code in PR #10424:
URL: https://github.com/apache/gravitino/pull/10424#discussion_r2943841949


##########
.github/workflows/build.yml:
##########
@@ -64,10 +65,52 @@ jobs:
               - spark-connector/**
             mcp_server_changes:
               - mcp-server/**
+            maintenance_source_changes:
+              - 'maintenance/**'
+            maintenance_changes:
+              - '.github/**'
+              - 'maintenance/**'
+              - 'api/**'
+              - 'common/**'
+              - 'core/**'
+              - 'catalogs/catalog-common/**'
+              - 'clients/client-java/**'
+              - 'integration-test-common/**'
+              - 'server/**'
+              - 'server-common/**'
+              - 'build.gradle.kts'
+              - 'gradle.properties'
+              - 'gradlew'
+              - 'settings.gradle.kts'
+              - 'gradle/**'
+      - name: Determine maintenance-only source changes
+        id: maintenance_only
+        env:
+          SOURCE_CHANGE_FILES: ${{ steps.filter.outputs.source_changes_files }}
+        run: |
+          python3 - <<'PY'
+          import json
+          import os
+
+          source_files = json.loads(os.environ.get("SOURCE_CHANGE_FILES") or 
"[]")
+          maintenance_only = bool(source_files) and all(
+            path.startswith("maintenance/") for path in source_files
+          )
+
+          with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as 
output:
+            output.write(
+              "maintenance_only_source_changes="
+              + ("true" if maintenance_only else "false")
+              + "\n"
+            )
+          PY
     outputs:
       source_changes: ${{ steps.filter.outputs.source_changes }}
       spark_connector_changes: ${{ 
steps.filter.outputs.spark_connector_changes }}
       mcp_server_changes: ${{ steps.filter.outputs.mcp_server_changes }}
+      maintenance_source_changes: ${{ 
steps.filter.outputs.maintenance_source_changes }}
+      maintenance_changes: ${{ steps.filter.outputs.maintenance_changes }}
+      maintenance_only_source_changes: ${{ 
steps.maintenance_only.outputs.maintenance_only_source_changes }}

Review Comment:
   You're right. The previous names were too close and made the usage of each 
flag hard to understand.
   
   I updated the workflow to:
   - rename `maintenance_source_changes` to `maintenance_module_changes`
   - rename `maintenance_changes` to `maintenance_related_changes`
   - add comments to explain the three different scenarios
   
   We still need three separate flags because they answer different routing 
questions:
   - `maintenance_module_changes`: whether the PR directly touches 
`maintenance/**`
   - `maintenance_related_changes`: whether the PR can affect maintenance 
validation, including upstream dependencies and shared Gradle files
   - `maintenance_only_source_changes`: whether all source changes in the PR 
are under `maintenance/**`, which is used to choose the maintenance-only build 
path
   
   Using a single flag here would either skip maintenance validation when 
upstream dependencies change, or incorrectly skip the normal root build for 
mixed changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to