From d4332d5705a6faf5cee7c5497a1be1c37d3e0e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Sun, 18 May 2025 09:38:47 +0200 Subject: [PATCH] ci: Experimental check for duplicate workflow --- .github/workflows/check_duplicates.yaml | 30 +++++++++++++++++++++++++ lib/utils/error_reporter.dart | 4 +--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/check_duplicates.yaml diff --git a/.github/workflows/check_duplicates.yaml b/.github/workflows/check_duplicates.yaml new file mode 100644 index 000000000..2d38d99bd --- /dev/null +++ b/.github/workflows/check_duplicates.yaml @@ -0,0 +1,30 @@ +name: Check Duplicates + +on: + issue: + types: [opened] + +jobs: + check_duplicates: + runs-on: ubuntu-latest + steps: + - name: Search for similar issues + run: echo "ISSUES=$(gh issue list --search '${{ github.event.issue.title }}' --json title,body | jq '[.[] | {title, body: (.body[:200])}]')" + - name: Send message to GPT + if: "${{ env.ISSUES != '[]' }}" + run: | + curl -X POST \ + https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${{ secrets.OPENAI_KEY }}" \ + -d '{ + "model": "gpt-3.5-turbo", + "messages": [ + {"role": "user", "content": "Please link possible duplications of this issue."}, + {"role": "user", "content": "${{ github.event.issue.title }}\n${{ github.event.issue.body }}"}, + {"role": "user", "content": "${{ env.ISSUES }}"} + ], + "temperature": 0.7 + }' + env: + OPENAI_KEY: ${{ secrets.OPENAI_KEY }} \ No newline at end of file diff --git a/lib/utils/error_reporter.dart b/lib/utils/error_reporter.dart index 95511a9e2..f4b5bce3b 100644 --- a/lib/utils/error_reporter.dart +++ b/lib/utils/error_reporter.dart @@ -48,9 +48,7 @@ class ErrorReporter { AdaptiveDialogAction( onPressed: () => launchUrl( AppConfig.newIssueUrl.resolveUri( - Uri( - queryParameters: {'template': 'bug_report.yaml'}, - ), + Uri(queryParameters: {'template': 'bug_report.yaml'}), ), mode: LaunchMode.externalApplication, ),