mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-04-24 23:56:21 +02:00
67 lines
2.2 KiB
YAML
67 lines
2.2 KiB
YAML
# 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
|