From 90d8bbf7b6b4cb3bd22bb142f6ddaeea84955da5 Mon Sep 17 00:00:00 2001 From: samarsajad <142666229+samarsajad@users.noreply.github.com> Date: Sat, 10 Aug 2024 12:27:18 +0530 Subject: [PATCH] Auto assign feature added --- .github/workflows/issue-assign.yml | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/issue-assign.yml diff --git a/.github/workflows/issue-assign.yml b/.github/workflows/issue-assign.yml new file mode 100644 index 0000000..0a3772a --- /dev/null +++ b/.github/workflows/issue-assign.yml @@ -0,0 +1,42 @@ +name: Auto Assign + +on: + issue_comment: + types: [created] + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + assign_issues: + if: > + (github.event_name == 'issue_comment' && ( + startsWith(github.event.comment.body, '/assign') || + startsWith(github.event.comment.body, '/unassign') || + contains(github.event.comment.body, 'assign to me') || + contains(github.event.comment.body, 'please assign me this') || + contains(github.event.comment.body, 'assign this to me') || + contains(github.event.comment.body, 'assign this issue to me') || + contains(github.event.comment.body, 'I can try fixing this') || + contains(github.event.comment.body, 'i am interested in doing this') || + contains(github.event.comment.body, 'I am interested in contributing'))) || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - name: Check for issue assignees + uses: actions/github-script@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issueNumber = context.payload.issue.number; + if (issueNumber) { + const commenter = context.payload.comment.user.login; + const config = { + owner: 'andoriyaprashant', + repo: 'OpSo', + issue_number: issueNumber, + assignees: [commenter] + }; + return github.issues.addAssignees(config); + } else { + return true; + } \ No newline at end of file