slawekjaranowski commented on code in PR #152:
URL: 
https://github.com/apache/maven-gh-actions-shared/pull/152#discussion_r1966562231


##########
.github/workflows/pr-automation.yml:
##########
@@ -115,3 +115,29 @@ jobs:
             
               console.log(result);
             }
+
+  # check PR assignee - if no one is assigned, assign to person who merge PR
+  assignees:
+    permissions:
+      issues: write
+      pull-requests: write
+
+    if: github.event.action == 'closed' && github.event.pull_request.merged && 
toJSON(github.event.pull_request.assignees) == '[]'
+    runs-on: ubuntu-latest
+    steps:
+
+      - name: Assign PR
+        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 
v7
+        with:
+          script: |
+            
+            console.log(context.issue.assignees);
+                        
+            const result = await github.rest.issues.update({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              assignees: [ '${{ github.event.pull_request.merged_by.login }}' ]

Review Comment:
   Will only execute if no one is assigned.
   See line 125:
   ```
   if: ... && toJSON(github.event.pull_request.assignees) == '[]'
   ```



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to