Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/detect-duplicate-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Detect Duplicate Issues

on:
issues:
types: [opened, reopened, edited]

jobs:
detect-duplicate:
runs-on: ubuntu-latest
permissions:
issues: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: pip install requests numpy scikit-learn sentence-transformers

- name: Compute cache key epoch (weekly)
id: cache-epoch
run: echo "week=$(date +%G-W%V)" >> "$GITHUB_OUTPUT"

- name: Restore issue embedding cache
id: restore-issue-cache
uses: actions/cache/restore@v4
with:
path: .github/workflows/.dup_issue_cache/embeddings
key: dup-issue-emb-${{ github.repository }}-${{ steps.cache-epoch.outputs.week }}
restore-keys: |
dup-issue-emb-${{ github.repository }}-

- name: Run duplicate Issue detection
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
REPO: ${{ github.repository }}
DRY_RUN: 0
USE_SENTENCE_TRANSFORMERS: 1
ISSUE_CANDIDATE_STATE: all
MAX_CANDIDATES: 500
TITLE_COMPARE_TOP_N: 25
TOP_K: 5
SIMILARITY_THRESHOLD: 0.82
TEXT_WEIGHT: 0.8
TITLE_WEIGHT: 0.2
AUTO_LABEL: 1
DUPLICATE_LABEL: possible-duplicate
ISSUE_EMBED_CACHE_DIR: .github/workflows/.dup_issue_cache/embeddings
ISSUE_EMBED_CACHE_WRITE: 1
run: python .github/workflows/scripts/detect_duplicate_issues.py

- name: Save issue embedding cache
if: ${{ steps.restore-issue-cache.outputs.cache-hit != 'true' }}
continue-on-error: true
uses: actions/cache/save@v4
with:
path: .github/workflows/.dup_issue_cache/embeddings
key: dup-issue-emb-${{ github.repository }}-${{ steps.cache-epoch.outputs.week }}
55 changes: 55 additions & 0 deletions .github/workflows/detect-duplicate-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Detect Duplicate PRs

on:
pull_request:
types: [opened, reopened, synchronize, edited, ready_for_review]

jobs:
detect-duplicate:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: pip install requests numpy scikit-learn sentence-transformers

- name: Compute cache key epoch (weekly)
id: cache-epoch
run: echo "week=$(date +%G-W%V)" >> "$GITHUB_OUTPUT"

- name: Restore PR file cache
id: restore-pr-cache
uses: actions/cache/restore@v4
with:
path: .github/workflows/.dup_pr_cache/files
key: dup-pr-files-${{ github.repository }}-${{ steps.cache-epoch.outputs.week }}
restore-keys: |
dup-pr-files-${{ github.repository }}-

- name: Run duplicate PR detection
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
DRY_RUN: 0
PR_FILE_CACHE_DIR: .github/workflows/.dup_pr_cache/files
PR_FILE_CACHE_WRITE: 1
PREFETCH_CANDIDATE_FILES: 1
run: python .github/workflows/scripts/detect_duplicate_prs.py

- name: Save PR file cache
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && steps.restore-pr-cache.outputs.cache-hit != 'true' }}
continue-on-error: true
uses: actions/cache/save@v4
with:
path: .github/workflows/.dup_pr_cache/files
key: dup-pr-files-${{ github.repository }}-${{ steps.cache-epoch.outputs.week }}
Loading
Loading