Skip to content

Commit 3bb8ced

Browse files
Update PR workflow to use auto-assign action
Replaced custom GitHub script with the `pozil/auto-assign-issue` action for assigning PRs to maintainers, improving clarity and maintainability. Adjusted permissions and streamlined the comment step to use the author environment variable.
1 parent 46bc724 commit 3bb8ced

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.github/workflows/pr-welcome.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,21 @@ on:
77
jobs:
88
welcome-and-assign:
99
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
pull-requests: write
1013

1114
steps:
1215
- name: Get PR Author
1316
id: pr_author
1417
run: echo "AUTHOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
1518

16-
- name: Assign PR to Maintainer
17-
uses: actions/github-script@v6
19+
- name: 'Auto-assign issue'
20+
uses: pozil/auto-assign-issue@39c06395cbac76e79afc4ad4e5c5c6db6ecfdd2e
1821
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-
});
22+
repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
assignees: HichemTab-tech
24+
numOfAssignee: 1
2625

2726
- name: Comment on PR (if not the maintainer)
2827
#if: env.AUTHOR != 'HichemTab-tech'
@@ -33,5 +32,5 @@ jobs:
3332
issue_number: context.payload.pull_request.number,
3433
owner: context.repo.owner,
3534
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. 🚀"
35+
body: "Thank you @${{ env.AUTHOR }} for your contribution! 🎉\n\nYour PR has been received and is awaiting review. Please be patient while we check it. 🚀"
3736
});

0 commit comments

Comments
 (0)