name: Check duplicates on: issues: types: [opened] jobs: check_duplicates: runs-on: ubuntu-latest env: title: ${{ github.event.issue.title }} author: ${{ github.event.issue.user.login }} number: ${{ github.event.issue.number }} GH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 - name: Check duplicates run: | issues=$(gh issue list --search '${{ env.title }}' --json number,title,url | jq -r 'map(select(.number != ${{ env.number }})) | .[] | "- [" + .title + "](" + .url + ")"') if [ "$ISSUES" != ""]; then gh issue comment ${{ github.event.issue.number }} --body "Thanks for reporting @${{ env.author }}.\nPlease check if this could be a duplicate of one of these issues:\n$issues" fi env: OPENAI_KEY: ${{ secrets.OPENAI_KEY }}