|
| 1 | +name: Assign Request Reminder |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: assign-reminder-${{ github.event.issue.number }}-${{ github.event.comment.id }} |
| 9 | + cancel-in-progress: false |
| 10 | + |
| 11 | +permissions: |
| 12 | + issues: write |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + remind-claim: |
| 17 | + name: Remind About /claim Command |
| 18 | + runs-on: ubuntu-latest |
| 19 | + if: >- |
| 20 | + !github.event.issue.pull_request && |
| 21 | + github.event.comment.user.type != 'Bot' && |
| 22 | + !contains(github.event.comment.body, '/claim') && |
| 23 | + !contains(github.event.comment.body, '/assign') && |
| 24 | + !contains(github.event.comment.body, '/unassign') && |
| 25 | + !contains(github.event.comment.body, '/addlabel') && |
| 26 | + !contains(github.event.comment.body, '/ping') && |
| 27 | + ( |
| 28 | + contains(github.event.comment.body, 'assign this issue to me') || |
| 29 | + contains(github.event.comment.body, 'assign this to me') || |
| 30 | + contains(github.event.comment.body, 'please assign me') || |
| 31 | + contains(github.event.comment.body, 'can i work on this') || |
| 32 | + contains(github.event.comment.body, 'can i take this') || |
| 33 | + contains(github.event.comment.body, 'i would like to work on this') || |
| 34 | + contains(github.event.comment.body, 'i want to work on this') || |
| 35 | + contains(github.event.comment.body, 'i''d like to work on this') || |
| 36 | + contains(github.event.comment.body, 'id like to work on this') || |
| 37 | + contains(github.event.comment.body, 'i want to take this issue') || |
| 38 | + contains(github.event.comment.body, 'i want to fix this') || |
| 39 | + contains(github.event.comment.body, 'i want to contribute') || |
| 40 | + contains(github.event.comment.body, 'let me work on this') || |
| 41 | + contains(github.event.comment.body, 'let me take this') || |
| 42 | + contains(github.event.comment.body, 'can i be assigned') || |
| 43 | + contains(github.event.comment.body, 'assign me to this') || |
| 44 | + contains(github.event.comment.body, 'assign me this') || |
| 45 | + contains(github.event.comment.body, 'work on this') || |
| 46 | + contains(github.event.comment.body, 'i''ll work on this') || |
| 47 | + contains(github.event.comment.body, 'ill work on this') || |
| 48 | + contains(github.event.comment.body, 'i can work on this') || |
| 49 | + contains(github.event.comment.body, 'i am interested in this') || |
| 50 | + contains(github.event.comment.body, 'assign') || |
| 51 | + contains(github.event.comment.body, 'i''m interested in this') |
| 52 | + ) |
| 53 | +
|
| 54 | + steps: |
| 55 | + - name: Post /claim Reminder |
| 56 | + uses: actions/github-script@v7 |
| 57 | + with: |
| 58 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + script: | |
| 60 | + const commenter = context.payload.comment.user.login; |
| 61 | + const issueAuthor = context.payload.issue.user.login; |
| 62 | + const { owner, repo } = context.repo; |
| 63 | + const issueNumber = context.payload.issue.number; |
| 64 | +
|
| 65 | + // Check if the issue is closed — no point reminding on closed issues. |
| 66 | + if (context.payload.issue.state === 'closed') return; |
| 67 | +
|
| 68 | + // Check if commenter is already assigned — no point reminding them. |
| 69 | + const assignees = context.payload.issue.assignees.map(a => a.login.toLowerCase()); |
| 70 | + if (assignees.includes(commenter.toLowerCase())) return; |
| 71 | +
|
| 72 | + const isOpenForAnyone = issueAuthor.toLowerCase() === 'jhasourav07'; |
| 73 | + const isAuthor = commenter.toLowerCase() === issueAuthor.toLowerCase(); |
| 74 | +
|
| 75 | + let claimEligibilityNote = ''; |
| 76 | + if (!isOpenForAnyone && !isAuthor) { |
| 77 | + claimEligibilityNote = `\n> ⚠️ **Note:** Only the issue author (@${issueAuthor}) can \`/claim\` this issue. If you'd like to contribute, consider opening a new issue for a bug or feature you've found, then claim that one!`; |
| 78 | + } |
| 79 | +
|
| 80 | + const bodyLines = [ |
| 81 | + `👋 Hey @${commenter}! Looks like you want to work on this issue — awesome! 🎉`, |
| 82 | + ``, |
| 83 | + `We don't assign issues through comments like this. Here's how our system works:`, |
| 84 | + ``, |
| 85 | + `## 🤖 How to Claim an Issue`, |
| 86 | + ``, |
| 87 | + `Comment \`/claim\` on this issue and our bot will automatically assign it to you (if you're eligible).`, |
| 88 | + ``, |
| 89 | + `\`\`\``, |
| 90 | + `/claim`, |
| 91 | + `\`\`\``, |
| 92 | + claimEligibilityNote, |
| 93 | + ``, |
| 94 | + `## 📋 A Few Things to Know`, |
| 95 | + ``, |
| 96 | + `- You can hold a **maximum of 3 open issues** at a time.`, |
| 97 | + `- If there's **no activity for 3 days**, the assignment will automatically expire so others can pick it up.`, |
| 98 | + `- Make sure to read our **[CONTRIBUTING.md](https://github.com/${owner}/${repo}/blob/main/CONTRIBUTING.md)** before you start — it covers code style, commit conventions, and the PR checklist.`, |
| 99 | + ``, |
| 100 | + `## 💬 Join Our Discord`, |
| 101 | + ``, |
| 102 | + `Get faster help, collaborate with other contributors, and stay updated with project news:`, |
| 103 | + ``, |
| 104 | + `[](https://discord.gg/Cb73bS79j)`, |
| 105 | + ``, |
| 106 | + `Happy contributing! 🚀`, |
| 107 | + ]; |
| 108 | + await github.rest.issues.createComment({ |
| 109 | + owner, |
| 110 | + repo, |
| 111 | + issue_number: issueNumber, |
| 112 | + body: bodyLines.join('\n'), |
| 113 | + }); |
0 commit comments