]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ci: Allow attaching claude-review label to PRs for automatic review 41142/head
authorDaan De Meyer <daan@amutable.com>
Tue, 17 Mar 2026 18:47:35 +0000 (19:47 +0100)
committerDaan De Meyer <daan@amutable.com>
Tue, 17 Mar 2026 19:07:23 +0000 (20:07 +0100)
- If a pr is labeled with claude-review, review it immediately
- If a pr labeled with claude-review is updated, review it regardless
of the author
- If a pr is opened by a maintainer, review it and add the claude-review
label. If the claude-review label is later removed, the pr won't be
auto-reviewed anymore.

.github/workflows/claude-review.yml

index 6860380fd850cba6c7978b2f91a2022601c6308b..736b459b0740da1e4b344e751b1a0b01fa957883 100644 (file)
@@ -11,7 +11,7 @@ name: Claude Review
 
 on:
   pull_request_target:
-    types: [opened, synchronize, reopened]
+    types: [opened, synchronize, reopened, labeled]
   # Strangely enough you have to use issue_comment to react to regular comments on PRs.
   # See https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request_comment-use-issue_comment.
   issue_comment:
@@ -33,8 +33,11 @@ jobs:
     if: |
       github.repository_owner == 'systemd' &&
       ((github.event_name == 'pull_request_target' &&
-        contains(fromJSON('["MEMBER","OWNER","COLLABORATOR"]'), github.event.pull_request.author_association) &&
-        github.event.pull_request.user.login != 'YHNdnzj') ||
+        (github.event.action == 'labeled' && github.event.label.name == 'claude-review' && github.event.sender.login != 'github-actions[bot]' ||
+         github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'claude-review') ||
+         github.event.action == 'opened' &&
+         contains(fromJSON('["MEMBER","OWNER","COLLABORATOR"]'), github.event.pull_request.author_association) &&
+         github.event.pull_request.user.login != 'YHNdnzj')) ||
        (github.event_name == 'issue_comment' &&
         github.event.issue.pull_request &&
         contains(github.event.comment.body, '@claude review') &&
@@ -56,6 +59,12 @@ jobs:
       comment_id: ${{ steps.tracking.outputs.comment_id }}
 
     steps:
+      - name: Auto-add claude-review label for trusted contributors
+        if: github.event_name == 'pull_request_target' && github.event.action == 'opened'
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: gh pr edit --repo "${{ github.repository }}" "$PR_NUMBER" --add-label claude-review
+
       - name: Resolve PR metadata
         id: pr
         env: