Skip to content

Commit 96d2065

Browse files
committed
add author of a pr as assignee
1 parent 9ee49eb commit 96d2065

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.github/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Run `tox`
77
- Close stale PRs
88
- Check for offensive language
9+
- Assign the PR to the author
910

1011
### On user action
1112
- Add to or remove a label from PR; supported labels: `wip`, `lgtm`, `verified`, and `hold`.
@@ -23,7 +24,6 @@
2324

2425
## To be added
2526
- Block merging if not all defined checks pass. For example: a `verified` label was added and at least 2 approvals.
26-
- When a PR is opened, assign the PR to the PR owner
2727
- When a PR is opened, add reviewers (requires updates to OWNERS file(s))
2828
- When a PR is reviewed/commented by a user who's not the PR owner, add `reviewed|commented|approved-by-<username>` label
2929
- When a PR is ready to be merged (all checks passed), add `ready-to-merge` label

.github/workflows/add-welcome-comment.yml renamed to .github/workflows/add-welcome-comment-set-assignee.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Add Welcome Comment
1+
name: Add Welcome Comment And Set PR Assignee
22
on:
33
pull_request_target:
44
types: [opened]
@@ -23,5 +23,5 @@ jobs:
2323
GITHUB_PR_NUMBER: ${{github.event.pull_request.number}}
2424
GITHUB_EVENT_ACTION: ${{github.event.action}}
2525
GITHUB_EVENT_NAME: ${{github.event_name}}
26-
ACTION: "add-welcome-comment"
26+
ACTION: "add-welcome-comment-set-assignee"
2727
run: uv run python .github/workflows/scripts/pr_workflow.py

.github/workflows/scripts/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* PR size label.
2626
* Run [pre-commit](https://pre-commit.ci/)
2727
* Run [tox](https://tox.wiki/)
28+
* Add PR author as the PR assignee
2829
2930
Available user actions:
3031
* To mark a PR as `WIP`, add `/wip` in a comment. To remove it from the PR comment `/wip cancel` to the PR.

.github/workflows/scripts/pr_workflow.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PrBaseClass:
3131
class SupportedActions:
3232
add_remove_labels_action_name: str = "add-remove-labels"
3333
pr_size_action_name: str = "add-pr-size-label"
34-
welcome_comment_action_name: str = "add-welcome-comment"
34+
welcome_comment_action_name: str = "add-welcome-comment-set-assignee"
3535
supported_actions: set[str] = {
3636
pr_size_action_name,
3737
add_remove_labels_action_name,
@@ -115,7 +115,7 @@ def run_pr_label_action(self) -> None:
115115
self.add_remove_pr_labels()
116116

117117
if self.action == self.SupportedActions.welcome_comment_action_name:
118-
self.add_welcome_comment()
118+
self.add_welcome_comment_set_assignee()
119119

120120
def get_pr_size(self) -> int:
121121
additions: int = 0
@@ -294,8 +294,9 @@ def issue_comment_label_actions(
294294
if commented_by_label not in self.pr_labels:
295295
self.add_pr_label(label=commented_by_label)
296296

297-
def add_welcome_comment(self) -> None:
297+
def add_welcome_comment_set_assignee(self) -> None:
298298
self.pr.create_issue_comment(body=WELCOME_COMMENT)
299+
self.pr.add_to_assignees(self.pr.user.login)
299300

300301

301302
def main() -> None:

0 commit comments

Comments
 (0)