name: Check Duplicates on: issues: types: [opened] jobs: check_duplicates: runs-on: ubuntu-latest env: title: ${{ github.event.issue.title }} body: ${{ github.event.issue.title }} GH_TOKEN: ${{ github.token }} steps: - name: Search for similar issues run: echo "issues=$(gh issue list --search '${{ env.title }}' --json title,body,url)" >> $GITHUB_ENV - name: Let Gemini reply run: | echo "${{ env.issues }}" RESPONSE=$(curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${{ secrets.GEMINI_KEY }}" \ -H 'Content-Type: application/json' \ -X POST \ -d '{ "contents": [{ "parts":[ {"text": "Please write a very short and nice response to this new issue. If existing link possible duplications by using markdown links."}, {"text": "${{ env.title }}\n${{ env.body }}"}, {"text": "Possible duplications:\n${{ env.issues }}"} ] }] }' | jq -r '.candidates[0].content.parts[0].text') echo $RESPONSE gh issue comment ${{ github.event.issue.number }} --body "$RESPONSE" env: OPENAI_KEY: ${{ secrets.OPENAI_KEY }}