chore: Fix check duplicates job
This commit is contained in:
parent
c018fd418c
commit
d417f1d9f4
1 changed files with 2 additions and 17 deletions
19
.github/workflows/check_duplicates.yaml
vendored
19
.github/workflows/check_duplicates.yaml
vendored
|
|
@ -9,7 +9,6 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
title: ${{ github.event.issue.title }}
|
title: ${{ github.event.issue.title }}
|
||||||
body: ${{ github.event.issue.title }}
|
|
||||||
author: ${{ github.event.issue.user.login }}
|
author: ${{ github.event.issue.user.login }}
|
||||||
number: ${{ github.event.issue.number }}
|
number: ${{ github.event.issue.number }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
@ -17,23 +16,9 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Check duplicates
|
- name: Check duplicates
|
||||||
run: |
|
run: |
|
||||||
ISSUES=$(gh issue list --search '${{ env.title }}' | grep -v "${{ env.number }}")
|
issues=$(gh issue list --search 'Unable to play video' --json number,title,url | jq -r 'map(select(.number != ${{ env.number }})) | .[] | "- [" + .title + "](" + .url + ")"')
|
||||||
echo $ISSUES
|
|
||||||
if [ "$ISSUES" != ""]; then
|
if [ "$ISSUES" != ""]; then
|
||||||
RESPONSE=$(curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${{ secrets.GEMINI_KEY }}" \
|
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"
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-X POST \
|
|
||||||
-d "{
|
|
||||||
\"contents\": [{
|
|
||||||
\"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
|
|
||||||
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