chore: Auto assign PR to author when PR opened (#11890)

- gh action to auto-assign PR to author when PR opened
This commit is contained in:
Muhsin Keloth
2025-07-10 11:36:37 +05:30
committed by GitHub
parent 5140deb6f6
commit 17500cc62d

28
.github/workflows/auto-assign-pr.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Auto-assign PR to Author
on:
pull_request:
types: [opened]
jobs:
auto-assign:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Auto-assign PR to author
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const pull_number = context.payload.pull_request.number;
const author = context.payload.pull_request.user.login;
await github.rest.issues.addAssignees({
owner,
repo,
issue_number: pull_number,
assignees: [author]
});
console.log(`Assigned PR #${pull_number} to ${author}`);