Phase 2: Developer Tooling & CLI Improvements #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto-assign Issue | |
| on: | |
| issue_comment: | |
| types: [created] | |
| permissions: | |
| issues: write | |
| jobs: | |
| assign: | |
| runs-on: ubuntu-latest | |
| if: github.event.issue.pull_request == null | |
| steps: | |
| - name: Auto-assign issue | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const comment = context.payload.comment.body.toLowerCase(); | |
| const phrases = [ | |
| "i'll take this", | |
| "i will take this", | |
| "i will work on this", | |
| "assign me", | |
| "je prends", | |
| "je vais travailler dessus" | |
| ]; | |
| const shouldAssign = phrases.some(phrase => comment.includes(phrase)); | |
| if (shouldAssign) { | |
| const issue = context.payload.issue; | |
| const commenter = context.payload.comment.user.login; | |
| // Check if issue has no assignee | |
| if (!issue.assignees || issue.assignees.length === 0) { | |
| await github.rest.issues.addAssignees({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| assignees: [commenter] | |
| }); | |
| } | |
| } | |