From 47a5496834b5feceff347a239a15913b200e5d8b Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Fri, 3 Apr 2026 16:26:29 +0800 Subject: [PATCH 01/14] Refactor issue dedupe workflows to call reusable workflow Replace inline workflow logic in all three issue dedup files with thin callers to opensearch-project/opensearch-build/.github/workflows/issue-dedupe.yml@main. This centralizes the dedupe logic (detect, auto-close, remove-label) into a single reusable workflow, reducing per-repo maintenance burden. Signed-off-by: Heng Qian --- .github/workflows/auto-close-duplicates.yml | 129 +----------------- .github/workflows/claude-dedupe-issues.yml | 40 ++---- .../remove-duplicate-on-activity.yml | 43 ++---- 3 files changed, 26 insertions(+), 186 deletions(-) diff --git a/.github/workflows/auto-close-duplicates.yml b/.github/workflows/auto-close-duplicates.yml index a51cb67d62..e78a3e2364 100644 --- a/.github/workflows/auto-close-duplicates.yml +++ b/.github/workflows/auto-close-duplicates.yml @@ -5,128 +5,11 @@ on: - cron: "0 9 * * *" workflow_dispatch: -permissions: - issues: write - jobs: auto-close-duplicates: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Close stale duplicate issues - uses: actions/github-script@v7 - env: - GRACE_DAYS: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} - with: - script: | - const { owner, repo } = context.repo; - const graceDays = parseInt(process.env.GRACE_DAYS, 10) || 7; - const GRACE_PERIOD_MS = graceDays * 24 * 60 * 60 * 1000; - const now = Date.now(); - - // Find all open issues with the duplicate label - const issues = await github.paginate(github.rest.issues.listForRepo, { - owner, - repo, - state: 'open', - labels: 'duplicate', - per_page: 100, - }); - - console.log(`Found ${issues.length} open issues with duplicate label`); - - let closedCount = 0; - - for (const issue of issues) { - console.log(`Processing issue #${issue.number}: ${issue.title}`); - - // Get comments to find the duplicate detection comment - const comments = await github.rest.issues.listComments({ - owner, - repo, - issue_number: issue.number, - per_page: 100, - }); - - // Find the duplicate detection comment (posted by our script) - const dupeComments = comments.data.filter(c => - c.body.includes('') - ); - - if (dupeComments.length === 0) { - console.log(` No duplicate detection comment found, skipping`); - continue; - } - - const lastDupeComment = dupeComments[dupeComments.length - 1]; - const dupeCommentAge = now - new Date(lastDupeComment.created_at).getTime(); - - if (dupeCommentAge < GRACE_PERIOD_MS) { - const daysLeft = ((GRACE_PERIOD_MS - dupeCommentAge) / (24 * 60 * 60 * 1000)).toFixed(1); - console.log(` Duplicate comment is too recent (${daysLeft} days remaining), skipping`); - continue; - } - - // Check for human comments after the duplicate detection comment - const humanCommentsAfter = comments.data.filter(c => - new Date(c.created_at) > new Date(lastDupeComment.created_at) && - c.user.type !== 'Bot' && - !c.body.includes('') && - !c.body.includes('automatically closed as a duplicate') - ); - - if (humanCommentsAfter.length > 0) { - console.log(` Has ${humanCommentsAfter.length} human comment(s) after detection, skipping`); - continue; - } - - // Check for thumbs-down reaction from the issue author - const reactions = await github.rest.reactions.listForIssueComment({ - owner, - repo, - comment_id: lastDupeComment.id, - per_page: 100, - }); - - const authorThumbsDown = reactions.data.some(r => - r.user.id === issue.user.id && r.content === '-1' - ); - - if (authorThumbsDown) { - console.log(` Issue author gave thumbs-down on duplicate comment, skipping`); - continue; - } - - // Extract the primary duplicate issue number from the comment - const dupeMatch = lastDupeComment.body.match(/#(\d+)/); - const dupeNumber = dupeMatch ? dupeMatch[1] : 'unknown'; - - // Close the issue - console.log(` Closing as duplicate of #${dupeNumber}`); - - await github.rest.issues.update({ - owner, - repo, - issue_number: issue.number, - state: 'closed', - state_reason: 'duplicate', - }); - - await github.rest.issues.addLabels({ - owner, - repo, - issue_number: issue.number, - labels: ['autoclose'], - }); - - await github.rest.issues.createComment({ - owner, - repo, - issue_number: issue.number, - body: `This issue has been automatically closed as a duplicate of #${dupeNumber}.\n\nIf this is incorrect, please reopen this issue or create a new one.\n\nšŸ¤– Generated with [Claude Code](https://claude.ai/code)`, - }); - - closedCount++; - } - - console.log(`Done. Closed ${closedCount} duplicate issue(s).`); + uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe.yml@main + permissions: + issues: write + with: + mode: 'auto-close' + grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/claude-dedupe-issues.yml index 60f7dc355d..d6c5d6f877 100644 --- a/.github/workflows/claude-dedupe-issues.yml +++ b/.github/workflows/claude-dedupe-issues.yml @@ -10,34 +10,16 @@ on: required: true type: string -permissions: - contents: read - issues: write - id-token: write - jobs: dedupe: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Configure AWS Credentials (OIDC) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ secrets.BEDROCK_ACCESS_ROLE }} - aws-region: us-east-1 - - - name: Run duplicate detection - uses: anthropics/claude-code-action@v1 - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_REPOSITORY: ${{ github.repository }} - DUPLICATE_GRACE_DAYS: ${{ vars.DUPLICATE_GRACE_DAYS }} - with: - use_bedrock: "true" - github_token: ${{ secrets.GITHUB_TOKEN }} - allowed_bots: "github-actions[bot]" - prompt: "/dedupe ${{ github.repository }}/issues/${{ github.event.issue.number || inputs.issue_number }}" - claude_args: "--model us.anthropic.claude-sonnet-4-5-20250929-v1:0" + uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe.yml@main + permissions: + contents: read + issues: write + id-token: write + secrets: + BEDROCK_ACCESS_ROLE: ${{ secrets.BEDROCK_ACCESS_ROLE }} + with: + mode: 'detect' + issue_number: ${{ github.event.issue.number || inputs.issue_number }} + dedupe_prompt: '/dedupe ${{ github.repository }}/issues/${{ github.event.issue.number || inputs.issue_number }}' diff --git a/.github/workflows/remove-duplicate-on-activity.yml b/.github/workflows/remove-duplicate-on-activity.yml index 81b0ee96ad..3b9a25116a 100644 --- a/.github/workflows/remove-duplicate-on-activity.yml +++ b/.github/workflows/remove-duplicate-on-activity.yml @@ -4,39 +4,14 @@ on: issue_comment: types: [created] -permissions: - issues: write - jobs: remove-duplicate: - if: | - github.event.issue.state == 'open' && - contains(github.event.issue.labels.*.name, 'duplicate') && - github.event.comment.user.type != 'Bot' - runs-on: ubuntu-latest - steps: - - name: Remove duplicate label - uses: actions/github-script@v7 - with: - script: | - const { owner, repo } = context.repo; - const issueNumber = context.issue.number; - const commenter = context.payload.comment.user.login; - - console.log(`Removing duplicate label from issue #${issueNumber} due to comment from ${commenter}`); - - try { - await github.rest.issues.removeLabel({ - owner, - repo, - issue_number: issueNumber, - name: 'duplicate', - }); - console.log(`Successfully removed duplicate label from issue #${issueNumber}`); - } catch (error) { - if (error.status === 404) { - console.log(`duplicate label was already removed from issue #${issueNumber}`); - } else { - throw error; - } - } + uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe.yml@main + permissions: + issues: write + with: + mode: 'remove-label' + issue_number: ${{ github.event.issue.number }} + issue_state: ${{ github.event.issue.state }} + has_duplicate_label: ${{ contains(github.event.issue.labels.*.name, 'duplicate') }} + commenter_is_bot: ${{ github.event.comment.user.type == 'Bot' }} From 19474072049a753fdc85e9416d50b1b5078d7877 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Fri, 3 Apr 2026 17:04:40 +0800 Subject: [PATCH 02/14] Temporarily point dedupe workflows to personal fork for testing Point reusable workflow references to qianheng-aws/opensearch-build branch add-issue-dedupe-workflow until the upstream PR is merged. Signed-off-by: Heng Qian --- .github/workflows/auto-close-duplicates.yml | 2 +- .github/workflows/claude-dedupe-issues.yml | 2 +- .github/workflows/remove-duplicate-on-activity.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-close-duplicates.yml b/.github/workflows/auto-close-duplicates.yml index e78a3e2364..0bcc0559c9 100644 --- a/.github/workflows/auto-close-duplicates.yml +++ b/.github/workflows/auto-close-duplicates.yml @@ -7,7 +7,7 @@ on: jobs: auto-close-duplicates: - uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe.yml@main + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe.yml@add-issue-dedupe-workflow permissions: issues: write with: diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/claude-dedupe-issues.yml index d6c5d6f877..b7fb8c2837 100644 --- a/.github/workflows/claude-dedupe-issues.yml +++ b/.github/workflows/claude-dedupe-issues.yml @@ -12,7 +12,7 @@ on: jobs: dedupe: - uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe.yml@main + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe.yml@add-issue-dedupe-workflow permissions: contents: read issues: write diff --git a/.github/workflows/remove-duplicate-on-activity.yml b/.github/workflows/remove-duplicate-on-activity.yml index 3b9a25116a..aef035c5b1 100644 --- a/.github/workflows/remove-duplicate-on-activity.yml +++ b/.github/workflows/remove-duplicate-on-activity.yml @@ -6,7 +6,7 @@ on: jobs: remove-duplicate: - uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe.yml@main + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe.yml@add-issue-dedupe-workflow permissions: issues: write with: From 8b3f4c9ae8e8b5c3cede7a4312b0671d8bdfc708 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Fri, 3 Apr 2026 17:55:14 +0800 Subject: [PATCH 03/14] Refactor dedupe workflows to use opensearch-build reusable workflows - Three caller workflows now delegate to opensearch-build reusable workflows - Remove .claude/commands/dedupe.md (prompt now lives in opensearch-build) - Remove scripts/comment-on-duplicates.sh (logic inlined in reusable workflow) Signed-off-by: Heng Qian --- .claude/commands/dedupe.md | 33 ------- .github/workflows/auto-close-duplicates.yml | 3 +- .github/workflows/claude-dedupe-issues.yml | 5 +- .../remove-duplicate-on-activity.yml | 3 +- scripts/comment-on-duplicates.sh | 90 ------------------- 5 files changed, 4 insertions(+), 130 deletions(-) delete mode 100644 .claude/commands/dedupe.md delete mode 100755 scripts/comment-on-duplicates.sh diff --git a/.claude/commands/dedupe.md b/.claude/commands/dedupe.md deleted file mode 100644 index 4a0adfcddb..0000000000 --- a/.claude/commands/dedupe.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -allowed-tools: Bash(gh:*), Bash(./scripts/comment-on-duplicates.sh:*) -description: Find duplicate GitHub issues ---- - -Find up to 3 likely duplicate issues for a given GitHub issue. - -Follow these steps precisely: - -1. Use `gh issue view ` to read the issue. If the issue is closed, or is broad product feedback without a specific bug/feature request, or already has a duplicate detection comment (containing ``), stop and report why you are not proceeding. - -2. Summarize the issue's core problem in 2-3 sentences. Identify the key terms, error messages, and affected components. - -3. Search for potential duplicates using **at least 3 different search strategies**. Run these searches in parallel. **Only consider issues with a lower issue number** (older issues) as potential originals — skip any result with a number >= the current issue. Also skip issues already labeled `duplicate`. - - `gh search issues "" --repo $GITHUB_REPOSITORY --state open -- -label:duplicate --limit 15 --json number,title | jq '[.[] | select(.number < )]'` - - `gh search issues "" --repo $GITHUB_REPOSITORY --state open -- -label:duplicate --limit 15 --json number,title | jq '[.[] | select(.number < )]'` - - `gh search issues "" --repo $GITHUB_REPOSITORY --state open -- -label:duplicate --limit 15 --json number,title | jq '[.[] | select(.number < )]'` - - `gh search issues "" --repo $GITHUB_REPOSITORY --state all -- -label:duplicate --limit 10 --json number,title | jq '[.[] | select(.number < )]'` (include closed issues for reference) - -4. For each candidate issue that looks like a potential match, read it with `gh issue view ` to verify it is truly about the same problem. Filter out false positives — issues that merely share keywords but describe different problems. - -5. If you find 1-3 genuine duplicates, post the result using the comment script: - ``` - ./scripts/comment-on-duplicates.sh --base-issue --potential-duplicates [dup2] [dup3] - ``` - -6. If no genuine duplicates are found, report that no duplicates were detected and take no further action. - -Important notes: -- Only flag issues as duplicates when you are confident they describe the **same underlying problem** -- Prefer open issues as duplicates, but closed issues can be referenced too -- Do not flag the issue as a duplicate of itself -- The base issue number is the last part of the issue reference (e.g., for `owner/repo/issues/42`, the number is `42`) diff --git a/.github/workflows/auto-close-duplicates.yml b/.github/workflows/auto-close-duplicates.yml index 0bcc0559c9..4bd9c0d007 100644 --- a/.github/workflows/auto-close-duplicates.yml +++ b/.github/workflows/auto-close-duplicates.yml @@ -7,9 +7,8 @@ on: jobs: auto-close-duplicates: - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe.yml@add-issue-dedupe-workflow + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@add-issue-dedupe-workflow permissions: issues: write with: - mode: 'auto-close' grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/claude-dedupe-issues.yml index b7fb8c2837..bde4cd5ee2 100644 --- a/.github/workflows/claude-dedupe-issues.yml +++ b/.github/workflows/claude-dedupe-issues.yml @@ -12,7 +12,7 @@ on: jobs: dedupe: - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe.yml@add-issue-dedupe-workflow + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-detect.yml@add-issue-dedupe-workflow permissions: contents: read issues: write @@ -20,6 +20,5 @@ jobs: secrets: BEDROCK_ACCESS_ROLE: ${{ secrets.BEDROCK_ACCESS_ROLE }} with: - mode: 'detect' issue_number: ${{ github.event.issue.number || inputs.issue_number }} - dedupe_prompt: '/dedupe ${{ github.repository }}/issues/${{ github.event.issue.number || inputs.issue_number }}' + grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} diff --git a/.github/workflows/remove-duplicate-on-activity.yml b/.github/workflows/remove-duplicate-on-activity.yml index aef035c5b1..476dbc608d 100644 --- a/.github/workflows/remove-duplicate-on-activity.yml +++ b/.github/workflows/remove-duplicate-on-activity.yml @@ -6,11 +6,10 @@ on: jobs: remove-duplicate: - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe.yml@add-issue-dedupe-workflow + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-remove-label.yml@add-issue-dedupe-workflow permissions: issues: write with: - mode: 'remove-label' issue_number: ${{ github.event.issue.number }} issue_state: ${{ github.event.issue.state }} has_duplicate_label: ${{ contains(github.event.issue.labels.*.name, 'duplicate') }} diff --git a/scripts/comment-on-duplicates.sh b/scripts/comment-on-duplicates.sh deleted file mode 100755 index 9c4eb49c07..0000000000 --- a/scripts/comment-on-duplicates.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# -# Copyright OpenSearch Contributors -# SPDX-License-Identifier: Apache-2.0 -# -# Posts a formatted duplicate detection comment and adds the duplicate label. -# -# Usage: -# ./scripts/comment-on-duplicates.sh --base-issue 123 --potential-duplicates 456 789 - -set -euo pipefail - -REPO="${GITHUB_REPOSITORY:-}" -BASE_ISSUE="" -DUPLICATES=() - -while [[ $# -gt 0 ]]; do - case $1 in - --base-issue) - BASE_ISSUE="$2" - shift 2 - ;; - --potential-duplicates) - shift - while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do - DUPLICATES+=("$1") - shift - done - ;; - *) - echo "Unknown argument: $1" >&2 - exit 1 - ;; - esac -done - -if [[ -z "$BASE_ISSUE" ]]; then - echo "Error: --base-issue is required" >&2 - exit 1 -fi - -if [[ ${#DUPLICATES[@]} -eq 0 ]]; then - echo "Error: --potential-duplicates requires at least one issue number" >&2 - exit 1 -fi - -REPO_FLAG=() -if [[ -n "$REPO" ]]; then - REPO_FLAG=("--repo" "$REPO") -fi - -# Build duplicate list -DUP_LIST="" -for dup in "${DUPLICATES[@]}"; do - TITLE=$(gh issue view "$dup" "${REPO_FLAG[@]}" --json title -q .title 2>/dev/null || echo "") - if [[ -n "$TITLE" ]]; then - DUP_LIST+="- #${dup} — ${TITLE}"$'\n' - else - DUP_LIST+="- #${dup}"$'\n' - fi -done - -# Build the comment body with a hidden marker for auto-close detection -BODY=" -### Possible Duplicate - -Found **${#DUPLICATES[@]}** possible duplicate issue(s): - -${DUP_LIST} -If this is **not** a duplicate: -- Add a comment on this issue, and the \`duplicate\` label will be removed automatically, or -- šŸ‘Ž this comment to prevent auto-closure - -Otherwise, this issue will be **automatically closed in ${DUPLICATE_GRACE_DAYS:-7} days**. - -šŸ¤– Generated with [Claude Code](https://claude.ai/code)" - -# Post the comment -echo "$BODY" | gh issue comment "$BASE_ISSUE" "${REPO_FLAG[@]}" --body-file - - -# Ensure the duplicate label exists -gh label create "duplicate" \ - --description "Issue is a duplicate of an existing issue" \ - --color "cccccc" \ - "${REPO_FLAG[@]}" 2>/dev/null || true - -# Add duplicate label -gh issue edit "$BASE_ISSUE" "${REPO_FLAG[@]}" --add-label "duplicate" - -echo "Posted duplicate comment and added duplicate label to issue #${BASE_ISSUE}" From 96d2bf57413b7d01f7de7b79427932a49d6e43bd Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Fri, 3 Apr 2026 19:58:07 +0800 Subject: [PATCH 04/14] Test: point dedupe detect to test-dedupe-debug branch Signed-off-by: Heng Qian --- .github/workflows/claude-dedupe-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/claude-dedupe-issues.yml index bde4cd5ee2..5dddc05d5f 100644 --- a/.github/workflows/claude-dedupe-issues.yml +++ b/.github/workflows/claude-dedupe-issues.yml @@ -12,7 +12,7 @@ on: jobs: dedupe: - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-detect.yml@add-issue-dedupe-workflow + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-detect.yml@test-dedupe-debug permissions: contents: read issues: write From 19976986da114f5933c3450aad7c05ef09ae15c2 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Fri, 3 Apr 2026 20:30:48 +0800 Subject: [PATCH 05/14] Point dedupe detect to PR branch for testing Signed-off-by: Heng Qian --- .github/workflows/claude-dedupe-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/claude-dedupe-issues.yml index 5dddc05d5f..bde4cd5ee2 100644 --- a/.github/workflows/claude-dedupe-issues.yml +++ b/.github/workflows/claude-dedupe-issues.yml @@ -12,7 +12,7 @@ on: jobs: dedupe: - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-detect.yml@test-dedupe-debug + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-detect.yml@add-issue-dedupe-workflow permissions: contents: read issues: write From 9fe7c9a36fdd7e605ee72428074a3697f9e0ef3a Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Fri, 3 Apr 2026 21:03:06 +0800 Subject: [PATCH 06/14] Simplify dedupe callers after reusable workflow input cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove redundant parameter passing — reusable workflows now derive issue context from github.event directly. Signed-off-by: Heng Qian --- .github/workflows/claude-dedupe-issues.yml | 1 - .github/workflows/remove-duplicate-on-activity.yml | 5 ----- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/claude-dedupe-issues.yml index bde4cd5ee2..7ef3a8cfa1 100644 --- a/.github/workflows/claude-dedupe-issues.yml +++ b/.github/workflows/claude-dedupe-issues.yml @@ -20,5 +20,4 @@ jobs: secrets: BEDROCK_ACCESS_ROLE: ${{ secrets.BEDROCK_ACCESS_ROLE }} with: - issue_number: ${{ github.event.issue.number || inputs.issue_number }} grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} diff --git a/.github/workflows/remove-duplicate-on-activity.yml b/.github/workflows/remove-duplicate-on-activity.yml index 476dbc608d..05a38099e7 100644 --- a/.github/workflows/remove-duplicate-on-activity.yml +++ b/.github/workflows/remove-duplicate-on-activity.yml @@ -9,8 +9,3 @@ jobs: uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-remove-label.yml@add-issue-dedupe-workflow permissions: issues: write - with: - issue_number: ${{ github.event.issue.number }} - issue_state: ${{ github.event.issue.state }} - has_duplicate_label: ${{ contains(github.event.issue.labels.*.name, 'duplicate') }} - commenter_is_bot: ${{ github.event.comment.user.type == 'Bot' }} From 5795be06891afd77aab5cb58c77e1030906e83e8 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Tue, 7 Apr 2026 11:07:03 +0800 Subject: [PATCH 07/14] Update dedupe caller to match latest reusable workflow changes - Point to opensearch-project/opensearch-build@main - Rename secret to BEDROCK_ACCESS_ROLE_ISSUE - Add schedule trigger and auto-close job - Remove workflow_dispatch (detect derives issue from github.event) Signed-off-by: Heng Qian --- .github/workflows/claude-dedupe-issues.yml | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/claude-dedupe-issues.yml index 7ef3a8cfa1..bf9d33b77f 100644 --- a/.github/workflows/claude-dedupe-issues.yml +++ b/.github/workflows/claude-dedupe-issues.yml @@ -1,23 +1,24 @@ +--- name: Claude Issue Dedupe - on: issues: types: [opened] - workflow_dispatch: - inputs: - issue_number: - description: 'Issue number to check for duplicates' - required: true - type: string + schedule: + - cron: '0 0 * * *' jobs: - dedupe: - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-detect.yml@add-issue-dedupe-workflow + detect: + if: github.event_name == 'issues' + uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-detect.yml@main permissions: contents: read issues: write id-token: write secrets: - BEDROCK_ACCESS_ROLE: ${{ secrets.BEDROCK_ACCESS_ROLE }} - with: - grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} + BEDROCK_ACCESS_ROLE_ISSUE: ${{ secrets.BEDROCK_ACCESS_ROLE_ISSUE }} + + auto-close: + if: github.event_name == 'schedule' + uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@main + permissions: + issues: write From 42154ce912acdc98c688e9d52c3a9eb20c67cda9 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Tue, 7 Apr 2026 11:09:41 +0800 Subject: [PATCH 08/14] Rename dedupe workflow to remove tool-specific naming Signed-off-by: Heng Qian --- .../workflows/{claude-dedupe-issues.yml => issue-dedupe.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{claude-dedupe-issues.yml => issue-dedupe.yml} (95%) diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/issue-dedupe.yml similarity index 95% rename from .github/workflows/claude-dedupe-issues.yml rename to .github/workflows/issue-dedupe.yml index bf9d33b77f..846a08fcb9 100644 --- a/.github/workflows/claude-dedupe-issues.yml +++ b/.github/workflows/issue-dedupe.yml @@ -1,5 +1,5 @@ --- -name: Claude Issue Dedupe +name: Issue Dedupe on: issues: types: [opened] From 6eb4360dcf64b728e367f0d350325c68abfa4e38 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Tue, 7 Apr 2026 11:21:44 +0800 Subject: [PATCH 09/14] Add dispatch for dedupe workflow Signed-off-by: Heng Qian --- .github/workflows/issue-dedupe.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/issue-dedupe.yml b/.github/workflows/issue-dedupe.yml index 846a08fcb9..6e957ea260 100644 --- a/.github/workflows/issue-dedupe.yml +++ b/.github/workflows/issue-dedupe.yml @@ -5,10 +5,16 @@ on: types: [opened] schedule: - cron: '0 0 * * *' + workflow_dispatch: + inputs: + issue_number: + description: 'Issue number to check for duplicates' + required: true + type: string jobs: detect: - if: github.event_name == 'issues' + if: github.event_name == 'issues' || github.event_name == 'workflow_dispatch' uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-detect.yml@main permissions: contents: read @@ -16,6 +22,8 @@ jobs: id-token: write secrets: BEDROCK_ACCESS_ROLE_ISSUE: ${{ secrets.BEDROCK_ACCESS_ROLE_ISSUE }} + with: + issue_number: ${{ inputs.issue_number || '' }} auto-close: if: github.event_name == 'schedule' From 4550154c9c99419429bc0bf2e5632b8b8995123b Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Tue, 7 Apr 2026 11:33:29 +0800 Subject: [PATCH 10/14] Add workflow_dispatch support for auto-close job Signed-off-by: Heng Qian --- .github/workflows/issue-dedupe.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-dedupe.yml b/.github/workflows/issue-dedupe.yml index 6e957ea260..eb68a886e3 100644 --- a/.github/workflows/issue-dedupe.yml +++ b/.github/workflows/issue-dedupe.yml @@ -7,14 +7,22 @@ on: - cron: '0 0 * * *' workflow_dispatch: inputs: - issue_number: - description: 'Issue number to check for duplicates' + job: + description: 'Job to run' required: true + type: choice + options: + - detect + - auto-close + default: detect + issue_number: + description: 'Issue number to check for duplicates (detect only)' + required: false type: string jobs: detect: - if: github.event_name == 'issues' || github.event_name == 'workflow_dispatch' + if: github.event_name == 'issues' || (github.event_name == 'workflow_dispatch' && inputs.job == 'detect') uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-detect.yml@main permissions: contents: read @@ -26,7 +34,7 @@ jobs: issue_number: ${{ inputs.issue_number || '' }} auto-close: - if: github.event_name == 'schedule' + if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.job == 'auto-close') uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@main permissions: issues: write From 184012e9bbe3969e6326e4c371629d50e691d57b Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Tue, 7 Apr 2026 11:36:09 +0800 Subject: [PATCH 11/14] Point dedupe workflows to fork branch for testing Signed-off-by: Heng Qian --- .github/workflows/issue-dedupe.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-dedupe.yml b/.github/workflows/issue-dedupe.yml index eb68a886e3..974cf35822 100644 --- a/.github/workflows/issue-dedupe.yml +++ b/.github/workflows/issue-dedupe.yml @@ -23,7 +23,7 @@ on: jobs: detect: if: github.event_name == 'issues' || (github.event_name == 'workflow_dispatch' && inputs.job == 'detect') - uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-detect.yml@main + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-detect.yml@add-issue-dedupe-workflow permissions: contents: read issues: write @@ -35,6 +35,6 @@ jobs: auto-close: if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.job == 'auto-close') - uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@main + uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@add-issue-dedupe-workflow permissions: issues: write From 0da4d6ca916476ef704d867e01b8df1b368c450a Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Tue, 7 Apr 2026 14:19:03 +0800 Subject: [PATCH 12/14] Consolidate dedupe workflows and add grace_days to auto-close Signed-off-by: Heng Qian --- .github/workflows/auto-close-duplicates.yml | 14 -------------- .github/workflows/issue-dedupe.yml | 2 ++ .github/workflows/remove-duplicate-on-activity.yml | 11 ----------- 3 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/auto-close-duplicates.yml delete mode 100644 .github/workflows/remove-duplicate-on-activity.yml diff --git a/.github/workflows/auto-close-duplicates.yml b/.github/workflows/auto-close-duplicates.yml deleted file mode 100644 index 4bd9c0d007..0000000000 --- a/.github/workflows/auto-close-duplicates.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Auto-close duplicate issues - -on: - schedule: - - cron: "0 9 * * *" - workflow_dispatch: - -jobs: - auto-close-duplicates: - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@add-issue-dedupe-workflow - permissions: - issues: write - with: - grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} diff --git a/.github/workflows/issue-dedupe.yml b/.github/workflows/issue-dedupe.yml index 974cf35822..2fcbbe8cb8 100644 --- a/.github/workflows/issue-dedupe.yml +++ b/.github/workflows/issue-dedupe.yml @@ -38,3 +38,5 @@ jobs: uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@add-issue-dedupe-workflow permissions: issues: write + with: + grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} diff --git a/.github/workflows/remove-duplicate-on-activity.yml b/.github/workflows/remove-duplicate-on-activity.yml deleted file mode 100644 index 05a38099e7..0000000000 --- a/.github/workflows/remove-duplicate-on-activity.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Remove duplicate label on activity - -on: - issue_comment: - types: [created] - -jobs: - remove-duplicate: - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-remove-label.yml@add-issue-dedupe-workflow - permissions: - issues: write From e6622dfb626419f4eee370d2976187937ad69a9b Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Tue, 7 Apr 2026 14:24:48 +0800 Subject: [PATCH 13/14] Pass grace_days to detect workflow via repo variable Signed-off-by: Heng Qian --- .github/workflows/issue-dedupe.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/issue-dedupe.yml b/.github/workflows/issue-dedupe.yml index 2fcbbe8cb8..bf6762cc4a 100644 --- a/.github/workflows/issue-dedupe.yml +++ b/.github/workflows/issue-dedupe.yml @@ -32,6 +32,7 @@ jobs: BEDROCK_ACCESS_ROLE_ISSUE: ${{ secrets.BEDROCK_ACCESS_ROLE_ISSUE }} with: issue_number: ${{ inputs.issue_number || '' }} + grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} auto-close: if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.job == 'auto-close') From 975083fe1f44000e86d626164d84ce2233888486 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Thu, 9 Apr 2026 20:30:25 +0800 Subject: [PATCH 14/14] Point dedupe workflows to upstream main and update secret name Signed-off-by: Heng Qian --- .github/workflows/issue-dedupe.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/issue-dedupe.yml b/.github/workflows/issue-dedupe.yml index bf6762cc4a..5bc792e2c9 100644 --- a/.github/workflows/issue-dedupe.yml +++ b/.github/workflows/issue-dedupe.yml @@ -23,20 +23,20 @@ on: jobs: detect: if: github.event_name == 'issues' || (github.event_name == 'workflow_dispatch' && inputs.job == 'detect') - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-detect.yml@add-issue-dedupe-workflow + uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-detect.yml@main permissions: contents: read issues: write id-token: write secrets: - BEDROCK_ACCESS_ROLE_ISSUE: ${{ secrets.BEDROCK_ACCESS_ROLE_ISSUE }} + BEDROCK_ACCESS_ROLE_ISSUE_DEDUPE: ${{ secrets.BEDROCK_ACCESS_ROLE_ISSUE_DEDUPE }} with: issue_number: ${{ inputs.issue_number || '' }} grace_days: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }} auto-close: if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.job == 'auto-close') - uses: qianheng-aws/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@add-issue-dedupe-workflow + uses: opensearch-project/opensearch-build/.github/workflows/issue-dedupe-autoclose.yml@main permissions: issues: write with: