Auto-Close Duplicates #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================= | |
| # Auto-Close Duplicate Issues | |
| # ============================================================================= | |
| # Runs daily at 10:00 UTC to close issues whose grace period has expired. | |
| # Also supports manual trigger via workflow_dispatch. | |
| # | |
| # Required secrets: | |
| # GH_PAT – Token with issues:write permission | |
| # ============================================================================= | |
| name: Auto-Close Duplicates | |
| on: | |
| schedule: | |
| # Daily at 10:00 UTC | |
| - cron: '0 10 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Run in dry-run mode (no side effects)' | |
| required: false | |
| default: 'false' | |
| type: choice | |
| options: | |
| - 'false' | |
| - 'true' | |
| grace_period_minutes: | |
| description: 'Grace period in minutes before a potential-duplicate issue is labelled duplicate and closed (overrides config). Leave empty to use the configured default.' | |
| required: false | |
| default: '' | |
| type: string | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| auto-close: | |
| name: Auto-Close Expired Duplicates | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Build CLI | |
| run: go build -o simili-cli ./cmd/simili/main.go | |
| - name: Run auto-close | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| GRACE_PERIOD_INPUT: ${{ inputs.grace_period_minutes }} | |
| run: | | |
| DRY_RUN_FLAG="" | |
| if [ "${{ inputs.dry_run }}" = "true" ]; then | |
| DRY_RUN_FLAG="--dry-run" | |
| fi | |
| GRACE_ARGS=() | |
| if [[ -n "$GRACE_PERIOD_INPUT" ]]; then | |
| if [[ "$GRACE_PERIOD_INPUT" =~ ^[0-9]+$ ]]; then | |
| GRACE_ARGS=("--grace-period-minutes" "$GRACE_PERIOD_INPUT") | |
| else | |
| echo "::warning::grace_period_minutes must be a positive integer; ignoring value '$GRACE_PERIOD_INPUT'" | |
| fi | |
| fi | |
| ./simili-cli auto-close \ | |
| --repo "${{ github.repository }}" \ | |
| --config .github/simili.yaml \ | |
| --verbose \ | |
| $DRY_RUN_FLAG \ | |
| "${GRACE_ARGS[@]}" |