mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-04-25 08:06:22 +02:00
Add GitHub Actions workflows for issue deduplication and auto-close
Co-authored-by: BukeLy <19304666+BukeLy@users.noreply.github.com>
This commit is contained in:
parent
f56261cee1
commit
b3cb9531a4
7 changed files with 1013 additions and 0 deletions
67
.github/workflows/backfill-dedupe.yml
vendored
Normal file
67
.github/workflows/backfill-dedupe.yml
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue