klion26 commented on code in PR #4448:
URL: https://github.com/apache/amoro/pull/4448#discussion_r4336215273
##########
.github/workflows/take.yml:
##########
@@ -31,7 +31,31 @@ jobs:
- uses: actions/github-script@v7
with:
script: |
- github.rest.issues.addAssignees({
+ const issue = await github.rest.issues.get({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ })
+
+ if (issue.data.assignees.length > 0) {
+ core.info('The issue is already assigned; ignoring this `take`
comment.')
+ return
+ }
+
+ const comments = await
github.paginate(github.rest.issues.listComments, {
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ per_page: 100,
+ })
+ const firstTakeComment = comments.find(comment => comment.body ===
'take')
+
+ if (firstTakeComment?.id !== context.payload.comment.id) {
Review Comment:
What will happen for the following case?
1. Alice `take` the issue`
2. Alice was unassigned because some reason(maybe she doesn't have time for
now)
3. Now the issue has no assignees
4. What would happen if Bob comment `take` happen?
Seems the `take` in step 4 would not assign the issue to Bob? We search the
previous comment here, as the `take` comment left by Alice is still there
--
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]