Skip to content

Commit 46bc724

Browse files
Refactor PR workflow to add assignee and improve comments
Replaced the old "Thank You Comment" workflow with a new "PR Welcome & Assign" workflow. The updated workflow automatically assigns the PR to a maintainer and posts a welcome comment only if the author is not the maintainer. This improves efficiency and provides clearer communication.
1 parent 3992acc commit 46bc724

File tree

2 files changed

+37
-21
lines changed

2 files changed

+37
-21
lines changed

.github/workflows/pr-welcome.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: PR Welcome & Assign
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
welcome-and-assign:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Get PR Author
13+
id: pr_author
14+
run: echo "AUTHOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
15+
16+
- name: Assign PR to Maintainer
17+
uses: actions/github-script@v6
18+
with:
19+
script: |
20+
github.issues.addAssignees({
21+
issue_number: context.payload.pull_request.number,
22+
owner: context.repo.owner,
23+
repo: context.repo.repo,
24+
assignees: ["HichemTab-tech"]
25+
});
26+
27+
- name: Comment on PR (if not the maintainer)
28+
#if: env.AUTHOR != 'HichemTab-tech'
29+
uses: actions/github-script@v6
30+
with:
31+
script: |
32+
github.issues.createComment({
33+
issue_number: context.payload.pull_request.number,
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
body: "Thank you @${{ github.event.pull_request.user.login }} for your contribution! 🎉\n\nYour PR has been received and is awaiting review. Please be patient while we check it. 🚀"
37+
});

.github/workflows/pull_request.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)