Copilot commented on code in PR #13762:
URL: https://github.com/apache/gluten/pull/13762#discussion_r4678960950


##########
.github/workflows/util/update-fork-build-status.js:
##########
@@ -53,6 +67,19 @@ function isTransient(e) {
 
 const runPath = (w) => '.github/workflows/' + w.file;
 
+// The `paths` and `paths-ignore` regexes the workflow passes to 
squash-merge-upstream,
+// read from its file so that the two cannot drift apart.
+function pathFilterOf(w) {
+  const text = fs.readFileSync(path.join(process.env.GITHUB_WORKSPACE || '.', 
runPath(w)), 'utf8');
+  const input = (name) => {
+    const m = new RegExp(`^\\s*${name}: '(.+)'\\s*$`, 'm').exec(text);
+    return m ? m[1].replace(/''/g, "'") : null;
+  };
+  const paths = input('paths');
+  if (!paths) throw new Error(`${runPath(w)} passes no single-quoted \`paths\` 
input to squash-merge-upstream`);
+  return { paths: new RegExp(paths), ignore: new RegExp(input('paths-ignore') 
|| '^$') };
+}

Review Comment:
   Parsing YAML via a line-regex is brittle: it depends on single quotes, 
one-line values, and assumes the first `paths:`/`paths-ignore:` occurrence is 
the intended one. A minor formatting change (double quotes, folded/multiline 
YAML, trailing comments, another `paths:` key elsewhere) could break the action 
by throwing and stop status updates. Consider switching to a YAML parser (e.g., 
`js-yaml`) and extracting the `with.paths` / `with.paths-ignore` values 
specifically from the `squash-merge-upstream` step, or (at minimum) making the 
regex tolerate both quote styles and ignoring trailing comments, with a safe 
fallback behavior instead of throwing.



##########
.github/workflows/velox_backend_x86.yml:
##########
@@ -224,7 +224,7 @@ jobs:
           match() { echo "$changed" | grep -qE "$1" && echo true || echo 
false; }
 
           echo "cpp=$(match      '^(cpp/|ep/build-velox/|dev/)')"              
                              >> $GITHUB_OUTPUT
-          echo "java=$(match     
'^(\.github/(workflows|actions)/|pom\.xml|backends-velox/|gluten-(uniffle|celeborn|ras|core|substrait|arrow|delta|iceberg|hudi|paimon)/|gluten-ut/(common/|test/|src-iceberg-upstream/|pom\.xml)|package/|build/mvn)')"
 >> $GITHUB_OUTPUT
+          echo "java=$(match     
'^(\.github/workflows/(velox_backend_x86|velox_native_build|iceberg_spark_ut|iceberg_upstream_revision)\.yml|\.github/workflows/util/(parallel-ut/|iceberg-upstream/|install-spark-deps\.sh)|\.github/actions/|pom\.xml|backends-velox/|gluten-(uniffle|celeborn|ras|core|substrait|arrow|delta|iceberg|hudi|paimon)/|gluten-ut/(common/|test/|src-iceberg-upstream/|pom\.xml)|package/|build/mvn)')"
 >> $GITHUB_OUTPUT

Review Comment:
   Within the `util/(...)` alternation, `install-spark-deps\\.sh` is not 
end-anchored, so a change like 
`.github/workflows/util/install-spark-deps.sh.bak` would incorrectly match and 
flip `java=true`, triggering broader jobs than intended. Anchor that 
alternative to the end of the path (e.g., `install-spark-deps\\.sh$`) to avoid 
false positives.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to