chore: fix duplicates job
This commit is contained in:
parent
a9bd48965e
commit
c005b320d4
1 changed files with 17 additions and 14 deletions
31
.github/workflows/check_duplicates.yaml
vendored
31
.github/workflows/check_duplicates.yaml
vendored
|
|
@ -11,26 +11,29 @@ jobs:
|
||||||
title: ${{ github.event.issue.title }}
|
title: ${{ github.event.issue.title }}
|
||||||
body: ${{ github.event.issue.title }}
|
body: ${{ github.event.issue.title }}
|
||||||
author: ${{ github.event.issue.author }}
|
author: ${{ github.event.issue.author }}
|
||||||
|
number: ${{ github.event.issue.number }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Check duplicates
|
- name: Check duplicates
|
||||||
run: |
|
run: |
|
||||||
ISSUES=$(gh issue list --search '${{ env.title }}')
|
ISSUES=$(gh issue list --search '${{ env.title }}' | grep -v "${{ number }}"")
|
||||||
echo $ISSUES
|
echo $ISSUES
|
||||||
RESPONSE=$(curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${{ secrets.GEMINI_KEY }}" \
|
if [ "$ISSUES" != ""]; then
|
||||||
-H 'Content-Type: application/json' \
|
RESPONSE=$(curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${{ secrets.GEMINI_KEY }}" \
|
||||||
-X POST \
|
-H 'Content-Type: application/json' \
|
||||||
-d "{
|
-X POST \
|
||||||
\"contents\": [{
|
-d "{
|
||||||
\"parts\":[
|
\"contents\": [{
|
||||||
{\"text\": \"Please compare issue title and body to possible duplications. If you think this issue could be a duplication, write a very short and nice response to this Github issue and link the possible duplication issues and ask the author ${{ env.author }} to check those. If you don't find any duplications, just reply with 'false'. \n\nIssue title: ${{ env.title }}\nIssue body: ${{ env.body }}\n\nPossible duplications:\n$ISSUES\"}
|
\"parts\":[
|
||||||
]
|
{\"text\": \"Please compare issue title and body to possible duplications. If you think this issue could be a duplication, write a very short and nice response to this Github issue and link the possible duplication issues and ask the author ${{ env.author }} to check those. If you don't find any duplications, just reply with 'false'. \n\nIssue title: ${{ env.title }}\nIssue body: ${{ env.body }}\n\nPossible duplications:\n$ISSUES\"}
|
||||||
}]
|
]
|
||||||
}" | jq -r '.candidates[0].content.parts[0].text')
|
}]
|
||||||
echo $RESPONSE
|
}" | jq -r '.candidates[0].content.parts[0].text')
|
||||||
if [ "$RESPONSE" != "false" ]; then
|
echo $RESPONSE
|
||||||
gh issue comment ${{ github.event.issue.number }} --body "$RESPONSE"
|
if [ "$RESPONSE" != "false" ]; then
|
||||||
|
gh issue comment ${{ github.event.issue.number }} --body "$RESPONSE"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
|
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue