Copilot commented on code in PR #4274:
URL: https://github.com/apache/flink-cdc/pull/4274#discussion_r2845707695


##########
.github/workflows/label.yml:
##########
@@ -21,17 +21,22 @@
 # https://github.com/actions/labeler
 
 name: Labeler
+
 on:
-  pull_request:
-    branches:
-      - master
-      - release-*
+  workflow_run:
+    workflows: [Labeler-Trigger]
+    types: [requested]

Review Comment:
   When using workflow_run triggers, the labeler action needs access to the 
pull request context to apply labels. While actions/labeler@v6 has support for 
workflow_run events, it relies on github.event.workflow_run.pull_requests being 
populated. 
   
   This should work since the triggering workflow (Labeler-Trigger) is 
triggered by pull_request events. However, unlike approve_label.yml which 
explicitly retrieves PR context using get-workflow-origin (lines 42-47), this 
implementation relies on the labeler action's built-in workflow_run support. 
   
   Consider testing this thoroughly, or add explicit PR context retrieval 
similar to approve_label.yml to ensure the labeler can identify which PR to 
label in all cases.
   ```suggestion
       types: [completed]
   ```



##########
.github/workflows/label_trigger.yml:
##########
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This workflow will triage pull requests and apply a label based on the
+# paths that are modified in the pull request.
+#
+# To use this workflow, you will need to set up a .github/label.yml

Review Comment:
   The comment references ".github/label.yml" but the actual configuration file 
appears to be ".github/labeler.yml" (as evidenced by the file existing in the 
repository). This documentation discrepancy could cause confusion for 
maintainers.
   ```suggestion
   # To use this workflow, you will need to set up a .github/labeler.yml
   ```



##########
.github/workflows/label.yml:
##########
@@ -21,17 +21,22 @@
 # https://github.com/actions/labeler
 
 name: Labeler
+
 on:
-  pull_request:
-    branches:
-      - master
-      - release-*
+  workflow_run:
+    workflows: [Labeler-Trigger]
+    types: [requested]
+
+permissions:
+  checks: write
+  contents: read
+  pull-requests: write
 
 jobs:
   label:
-
     runs-on: ubuntu-latest
     permissions:
+      checks: write
       contents: read
       pull-requests: write

Review Comment:
   Permissions are specified at both the workflow level (lines 30-33) and job 
level (lines 38-41). This duplication is redundant when the permissions are 
identical. Consider removing the job-level permissions declaration to match the 
pattern used in approve_label.yml, which only specifies permissions at the 
workflow level.
   ```suggestion
   
   ```



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