|
| 1 | +name: Auto Acknowledge GH Issues |
| 2 | + |
| 3 | +on: |
| 4 | + issues: |
| 5 | + types: [opened] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + issues: write |
| 10 | +jobs: |
| 11 | + acknowledge: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + issues: read |
| 15 | + steps: |
| 16 | + # Step 1: Wait 15 minutes |
| 17 | + - name: Wait 15 minutes |
| 18 | + run: sleep 10 |
| 19 | + |
| 20 | + # Step 2: Check if a maintainer already responded |
| 21 | + - name: Check for existing maintainer response |
| 22 | + id: check |
| 23 | + uses: actions/github-script@v7 |
| 24 | + with: |
| 25 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + script: | |
| 27 | + const maintainers = ['sumitmsft','dlevy-msft-sql']; |
| 28 | +
|
| 29 | + const comments = await github.rest.issues.listComments({ |
| 30 | + owner: context.repo.owner, |
| 31 | + repo: context.repo.repo, |
| 32 | + issue_number: context.payload.issue.number |
| 33 | + }); |
| 34 | +
|
| 35 | + const maintainerReplied = comments.data.some( |
| 36 | + comment => maintainers.includes(comment.user.login) |
| 37 | + ); |
| 38 | +
|
| 39 | + core.setOutput('skip', maintainerReplied.toString()); |
| 40 | + console.log(`Maintainer already replied: ${maintainerReplied}`); |
| 41 | +
|
| 42 | + # Step 3: Post acknowledgement ONLY if no maintainer has responded |
| 43 | + - name: Post acknowledgement comment |
| 44 | + if: steps.check.outputs.skip == 'false' |
| 45 | + uses: actions/github-script@v7 |
| 46 | + with: |
| 47 | + github-token: ${{ secrets.SUMIT_PAT_FOR_AUTO_RESPONSE }} |
| 48 | + script: | |
| 49 | + await github.rest.issues.createComment({ |
| 50 | + owner: context.repo.owner, |
| 51 | + repo: context.repo.repo, |
| 52 | + issue_number: context.payload.issue.number, |
| 53 | + body: `Hi @${context.payload.issue.user.login}, thank you for opening this issue!\n\nOur team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.\n\nThank you for your patience!` |
| 54 | + }); |
0 commit comments