1010
1111concurrency :
1212 group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
13- cancel-in-progress : true
13+ cancel-in-progress : ${{ github.event_name == 'pull_request' }}
1414
1515jobs :
1616 review :
@@ -20,15 +20,14 @@ jobs:
2020 models : read
2121 pull-requests : write
2222 timeout-minutes : 10
23- # Run on pull_request events from mlflow/mlflow (not forks) or when harupy comments '/review' on a pull request
23+ # Run on pull_request events from mlflow/mlflow (not forks) or when anyone comments '/review' on a pull request
2424 if : >
2525 (github.event_name == 'pull_request' &&
2626 github.event.pull_request.head.repo.full_name == 'mlflow/mlflow')
2727 ||
2828 (github.event_name == 'issue_comment' &&
2929 github.event.issue.pull_request &&
30- startsWith(github.event.comment.body, '/review') &&
31- github.event.comment.user.login == 'harupy')
30+ startsWith(github.event.comment.body, '/review'))
3231 steps :
3332 - name : React to comment
3433 if : ${{ github.event_name == 'issue_comment' }}
4241 comment_id: comment.id,
4342 content: 'rocket'
4443 });
44+ - name : Check authorization for issue comment
45+ if : ${{ github.event_name == 'issue_comment' && github.event.comment.user.login != 'harupy' }}
46+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
47+ with :
48+ script : |
49+ // Leave a comment indicating only 'harupy' is allowed to trigger the workflow
50+ await github.rest.issues.createComment({
51+ owner: context.repo.owner,
52+ repo: context.repo.repo,
53+ issue_number: context.issue.number,
54+ body: "⚠️ Only **harupy** is authorized to trigger this workflow via comments. Your request has been ignored."
55+ });
56+
57+ // Fail the workflow to abort further execution
58+ throw new Error("Unauthorized user attempted to trigger workflow: " + context.payload.comment.user.login);
4559 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4660 with :
4761 sparse-checkout : |
@@ -98,20 +112,21 @@ jobs:
98112
99113 # Instructions
100114
101- ## 1. Fetch and Analyze PR
115+ ## 1. Fetch PR and Review Against Style Guide
102116 - Use `fetch_diff` tool to fetch the PR diff
103- - Carefully examine all changes in the diff
104-
105- ## 2. Review Against Style Guide
106117 - Read `dev/guides/python.md` thoroughly
107- - Check for violations of the style guide
118+ - Carefully examine ONLY the changed lines (added or modified) in the diff
119+ - Check for style guide violations ONLY in these changed lines
120+ - Ignore unchanged/context lines and pre-existing code
108121
109- ## 3 . Decision Point
122+ ## 2 . Decision Point
110123 - If NO issues found -> Skip remaining steps
111- - If issues found -> Continue to step 4
124+ - If issues found -> Continue to step 3
112125
113- ## 4 . Add Review Comments
126+ ## 3 . Add Review Comments
114127 - Use `add_pr_review_comment` tool for each issue found
128+ - ONLY comment on lines that are marked as added (+) or modified in the diff
129+ - Never comment on unchanged context lines or pre-existing code
115130 - Comment parameters:
116131 - Single-line: Set `subject_type` to `LINE`, specify `line`
117132 - Multi-line: Set `subject_type` to `LINE`, specify both `start_line` and `line`
@@ -128,4 +143,4 @@ jobs:
128143 PR_URL : ${{ github.event.issue.pull_request.html_url || github.event.pull_request.html_url}}
129144 run : |
130145 # Use timeout in case codex hangs
131- timeout 3m ./codex exec --skip-git-repo-check "Can you review $PR_URL?" || true
146+ timeout 5m ./codex exec --skip-git-repo-check "Can you review $PR_URL?" || true
0 commit comments