PageIndex/.github/workflows/backfill-dedupe.yml
copilot-swe-agent[bot] b3cb9531a4 Add GitHub Actions workflows for issue deduplication and auto-close
Co-authored-by: BukeLy <19304666+BukeLy@users.noreply.github.com>
2026-03-02 03:54:18 +00:00

67 lines
2.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Backfills duplicate detection for historical issues.
# Triggered manually via workflow_dispatch.
name: Backfill Duplicate Detection
on:
workflow_dispatch:
inputs:
days_back:
description: 'How many days back to look for issues (default: 30)'
required: false
default: '30'
type: number
dry_run:
description: 'Dry run analyze but do not post comments or apply labels'
required: false
default: 'false'
type: choice
options:
- 'false'
- 'true'
permissions:
issues: write
contents: read
jobs:
backfill:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Ensure required labels exist
uses: actions/github-script@v7
with:
script: |
const labels = [
{ name: 'duplicate', color: 'cfd3d7', description: 'This issue or pull request already exists' },
{ name: 'autoclose', color: 'e4e669', description: 'Will be auto-closed after a period of inactivity' },
];
for (const label of labels) {
try {
await github.rest.issues.getLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
});
} catch (err) {
if (err.status === 404) {
await github.rest.issues.createLabel({
owner: context.repo.owner, repo: context.repo.repo,
name: label.name, color: label.color, description: label.description,
});
core.info(`Created label: ${label.name}`);
}
}
}
- name: Run backfill script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.AUTHROPIC_API_KEY }}
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
DAYS_BACK: ${{ inputs.days_back }}
DRY_RUN: ${{ inputs.dry_run }}
run: node scripts/backfill-dedupe.js