This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch v4 in repository https://gitbox.apache.org/repos/asf/maven-gh-actions-shared.git
The following commit(s) were added to refs/heads/v4 by this push: new b3042a4 Assign PR to person who merge it b3042a4 is described below commit b3042a4bc2b02b478d6cd04f2db1fb709afdd907 Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Sat Feb 22 15:31:34 2025 +0100 Assign PR to person who merge it --- .github/workflows/pr-automation.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index 715b5ed..6b25c09 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -115,3 +115,30 @@ 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.payload.pull_request); + console.log(context.payload.pull_request.merged_by); + + const result = await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + assignees: [ context.payload.pull_request.merged_by.login ] + }); + + console.log(result);