github-actions[bot] commented on code in PR #62552:
URL: https://github.com/apache/doris/pull/62552#discussion_r3091518813


##########
.github/workflows/opencode-review.yml:
##########
@@ -3,16 +3,66 @@ name: Code Review
 on:
   pull_request_target:
     types: [opened, synchronize, reopened, ready_for_review]
+  issue_comment:
+    types: [created, edited]
 
 permissions:
   pull-requests: read
   statuses: write
 
 jobs:
+  skip-on-comment:
+    name: Skip review via skip buildall comment
+    runs-on: ubuntu-latest
+    if: >
+      github.event_name == 'issue_comment' &&
+      github.event.issue.pull_request != null &&
+      contains(github.event.comment.body, 'skip buildall')
+    steps:
+      - name: Check user permission and mark review as success
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          REPO: ${{ github.repository }}
+          COMMENT_USER_ID: ${{ github.event.comment.user.id }}
+          PR_NUMBER: ${{ github.event.issue.number }}
+        run: |
+          PR_INFO=$(gh api repos/${REPO}/pulls/${PR_NUMBER})
+          HEAD_SHA=$(echo "${PR_INFO}" | jq -r '.head.sha')
+          TARGET_BRANCH=$(echo "${PR_INFO}" | jq -r '.base.ref')
+
+          ALLOWED=false
+          if [[ "${COMMENT_USER_ID}" == '27881198' || "${COMMENT_USER_ID}" == 
'37901441' || "${COMMENT_USER_ID}" == '61408379' ]]; then

Review Comment:
   This duplicates the `skip buildall` allowlist from 
`.github/workflows/comment-to-trigger-teamcity.yml`, but it has already 
drifted: `61408379` is authorized here and nowhere in the existing 
skip-buildall path. Because this job writes the required `code-review` status 
directly, that account can now bypass AI review on any branch even though it 
cannot currently `skip buildall`. Please keep the two policies identical or 
move the permission check to a shared source of truth.



##########
.github/workflows/opencode-review.yml:
##########
@@ -3,16 +3,66 @@ name: Code Review
 on:
   pull_request_target:
     types: [opened, synchronize, reopened, ready_for_review]
+  issue_comment:
+    types: [created, edited]
 
 permissions:
   pull-requests: read
   statuses: write
 
 jobs:
+  skip-on-comment:
+    name: Skip review via skip buildall comment
+    runs-on: ubuntu-latest
+    if: >
+      github.event_name == 'issue_comment' &&
+      github.event.issue.pull_request != null &&
+      contains(github.event.comment.body, 'skip buildall')
+    steps:
+      - name: Check user permission and mark review as success
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          REPO: ${{ github.repository }}
+          COMMENT_USER_ID: ${{ github.event.comment.user.id }}
+          PR_NUMBER: ${{ github.event.issue.number }}
+        run: |
+          PR_INFO=$(gh api repos/${REPO}/pulls/${PR_NUMBER})
+          HEAD_SHA=$(echo "${PR_INFO}" | jq -r '.head.sha')
+          TARGET_BRANCH=$(echo "${PR_INFO}" | jq -r '.base.ref')
+
+          ALLOWED=false
+          if [[ "${COMMENT_USER_ID}" == '27881198' || "${COMMENT_USER_ID}" == 
'37901441' || "${COMMENT_USER_ID}" == '61408379' ]]; then
+              ALLOWED=true
+          elif [[ "${COMMENT_USER_ID}" == '9208457' && "${TARGET_BRANCH}" == 
*'branch-2.1'* ]]; then
+              ALLOWED=true
+          elif [[ "${COMMENT_USER_ID}" == '98214048' && "${TARGET_BRANCH}" == 
*'branch-3.0'* ]]; then
+              ALLOWED=true
+          elif [[ "${COMMENT_USER_ID}" == '101034200' && "${TARGET_BRANCH}" == 
*'branch-3.1'* ]]; then
+              ALLOWED=true
+          elif [[ ("${COMMENT_USER_ID}" == '9208457' || "${COMMENT_USER_ID}" 
== '2899462') && "${TARGET_BRANCH}" == *'branch-4.0'* ]]; then
+              ALLOWED=true
+          elif [[ "${COMMENT_USER_ID}" == '9208457' && "${TARGET_BRANCH}" == 
*'branch-4.1'* ]]; then
+              ALLOWED=true
+          fi
+
+          if [[ "${ALLOWED}" != 'true' ]]; then
+              echo "COMMENT_USER_ID ${COMMENT_USER_ID} is not allowed to skip 
code review."
+              exit 0
+          fi
+
+          echo "COMMENT_USER_ID ${COMMENT_USER_ID} is allowed to skip code 
review for ${TARGET_BRANCH}."
+          gh api repos/${REPO}/statuses/${HEAD_SHA} \

Review Comment:
   `code-review` is also written by 
`.github/workflows/opencode-review-comment.yml` (`mark-review-pending` / 
`refresh-required-check`). If a `/review` run is already in flight when someone 
comments `skip buildall`, this `success` can be overwritten later by 
`refresh-required-check` posting `pending` for the same HEAD SHA. In that 
scenario the skip does not actually skip AI review; final state is just 
last-writer-wins. Please coordinate these workflows so a later refresh can 
recognize and preserve an explicit skip.



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