rich7420 commented on code in PR #10851:
URL: https://github.com/apache/ozone/pull/10851#discussion_r3830193351


##########
.github/workflows/schedule-label-pr.yml:
##########
@@ -18,9 +18,10 @@
 name: scheduled-label-pull-requests
 
 on:
-  # every 5 minutes
+  # every 30 minutes; component labeling scans all open PRs, so keep the
+  # cadence moderate
   schedule:
-    - cron: '*/5 * * * *'
+    - cron: '*/30 * * * *'

Review Comment:
   nit: no `concurrency` guard. `component-labeler` scans every open PR and 
scales with their count; if a run overruns 30 min under API throttling it 
overlaps the next, doubling API spend and racing add/remove on labels. Add at 
workflow level:
   
   ```yaml
   concurrency:
     group: scheduled-label-pull-requests
     cancel-in-progress: false
   ```



##########
.github/workflows/label-pr.yml:
##########
@@ -51,3 +53,31 @@ jobs:
           BRANCH: ${{ matrix.branch }}
           LABEL: ${{ matrix.label }}
           GH_TOKEN: ${{ github.token }}
+
+  component-labeler:
+    permissions:
+      contents: read
+      pull-requests: write
+    runs-on: ubuntu-slim
+    steps:
+      - name: "Checkout project" # provides .github/labeler.yml for the 
labeler action
+        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 
v7.0.1
+        with:
+          persist-credentials: false
+          sparse-checkout: |
+            .github
+      - name: "List open PRs"
+        id: prs
+        run: |
+          {
+            echo 'numbers<<EOF'
+            gh pr list --repo "$GITHUB_REPOSITORY" --state open --limit 1000 
--json number --jq '.[].number'
+            echo 'EOF'
+          } >> "$GITHUB_OUTPUT"
+        env:
+          GH_TOKEN: ${{ github.token }}
+      - name: "Apply component labels"
+        uses: actions/labeler@b8dd2d9be0f68b860e7dae5dae7d772984eacd6d # v6.2.0
+        with:
+          pr-number: ${{ steps.prs.outputs.numbers }}
+          sync-labels: true

Review Comment:
   `sync-labels: true` makes all 13 labels automation-owned — it strips any 
applied by topic rather than path, every 30 min. The `s3` case (#10006) 
generalizes: simulating the globs, a docs-only PR resolves to `documentation` 
(strips a manual `s3`); an OM erasure-coding change resolves to `om` (strips a 
manual `EC`); a code-only PR strips a manual `documentation`. Worth deciding 
`s3` / `EC` / `documentation` together — keep them path-based, drop those 
rules, or namespace them (`comp:s3`…) so they can't collide with human topic 
labels.



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