mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-10-13 17:02:17 -05:00
93 lines
3.3 KiB
YAML
93 lines
3.3 KiB
YAML
# Copied from https://github.com/anomalyco/opencode/blob/dev/.github/workflows/duplicate-issues.yml
|
|
# And modified
|
|
# Original license: MIT License Copyright (c) 2025 opencode
|
|
|
|
name: duplicate-issues
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
check-duplicates:
|
|
if: >-
|
|
(github.event_name == 'issues' && github.event.action == 'opened') ||
|
|
(github.event_name == 'issue_comment' && github.event.issue.pull_request == null && contains(github.event.comment.body, '/check-dup'))
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install opencode
|
|
run: curl -fsSL https://opencode.ai/v2/install | bash
|
|
|
|
- uses: $/.github/actions/setup-atlascloud
|
|
with:
|
|
api-key: ${{ secrets.ATLASCLOUD_API_KEY }}
|
|
|
|
- name: Check for duplicate issues
|
|
env:
|
|
ATLASCLOUD_API_KEY: ${{ secrets.ATLASCLOUD_API_KEY }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
OPENCODE_PERMISSION: |
|
|
{
|
|
"bash": {
|
|
"*": "deny",
|
|
"gh issue*": "allow"
|
|
},
|
|
"webfetch": "deny"
|
|
}
|
|
run: |
|
|
mapfile -t models < <(jq -r '.[]' .github/opencode-models.json)
|
|
|
|
PROMPT=$(cat <<'PROMPT_EOF'
|
|
An issue has been submitted (or a duplicate check was requested on it):
|
|
|
|
Issue number: ${{ github.event.issue.number }}
|
|
|
|
Lookup this issue with gh issue view ${{ github.event.issue.number }}.
|
|
|
|
Search through existing issues (excluding #${{ github.event.issue.number }}) in this repository to find any potential duplicates or related issues.
|
|
Consider:
|
|
1. Similar titles or descriptions
|
|
2. Same error messages or symptoms
|
|
3. Related functionality or components
|
|
4. Similar feature requests
|
|
|
|
After listing candidates with gh issue list, run gh issue view <number> on the top few to compare their bodies (error messages, reproduction steps, stack traces) against this issue before deciding.
|
|
|
|
If you find any potential duplicates or related issues, please comment on the issue with:
|
|
- A brief explanation of why it might be a duplicate or related
|
|
- Links to the potentially duplicate issues
|
|
- A suggestion to check those issues first
|
|
|
|
Use this exact format for the comment:
|
|
'This issue might be a duplicate of or related to existing issues. Please check:
|
|
- #[issue_number]: [brief description of similarity]
|
|
|
|
Feel free to ignore if none of these address your specific case.'
|
|
|
|
If no clear duplicates or related issues are found, do not comment.
|
|
PROMPT_EOF
|
|
)
|
|
|
|
for model in "${models[@]}"; do
|
|
echo "Trying model: $model"
|
|
if opencode run -m "$model" "$PROMPT"; then
|
|
echo "Completed with model: $model"
|
|
exit 0
|
|
fi
|
|
echo "::warning::Model $model failed, trying the next fallback model."
|
|
done
|
|
|
|
echo "::error::All fallback models failed."
|
|
exit 1
|