You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add grace-period-minutes
Signed-off-by: SachinduNethmin <108050026+Sachindu-Nethmin@users.noreply.github.com>
* fix(workflow): fall back to github.token when GH_PAT lacks issues scope
The built-in github.token already has issues:write via the workflow
permissions block, so prefer it when GH_PAT is absent or misconfigured.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: SachinduNethmin <108050026+Sachindu-Nethmin@users.noreply.github.com>
* fix(workflow): use built-in github.token instead of GH_PAT
GH_PAT is set but missing issues:write scope, causing 403 errors.
The workflow already declares permissions: issues: write, so the
built-in github.token has everything needed to close and label issues.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: SachinduNethmin <108050026+Sachindu-Nethmin@users.noreply.github.com>
* test(auto-close): add grace-period-minutes tests and docs
Tests added:
- TestGracePeriodFromConfig: validates minutes override > hours config > 72h
default precedence in the grace period computation logic
- TestGracePeriodMinutesExpiry: validates expiry checks across several
minutes-based grace periods and label ages
- TestGracePeriodMinutesCLIMapping: validates that CLI flag 0/negative maps
to 1, positive values are stored as-is, and absent flag leaves override at 0
- TestRepoFlagParsing: validates owner/repo split for valid and invalid inputs
Docs added:
- README: new simili auto-close CLI section covering flags, grace period
precedence table, simili.yaml config, human activity signals, and
workflow_dispatch usage example
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: SachinduNethmin <108050026+Sachindu-Nethmin@users.noreply.github.com>
* fix(workflow): prevent shell injection in grace_period_minutes input
inputs.grace_period_minutes is a free-text string that was previously
interpolated directly into the shell script body, allowing a crafted
value (e.g. "1 $(malicious)") to execute arbitrary commands.
Fix:
- Assign the input to GRACE_PERIOD_INPUT env var so it never reaches
the script body as a template expression.
- Validate with ^[0-9]+$ before use; emit a ::warning:: and skip the
flag if the value is non-numeric.
- Build the argument as a bash array (GRACE_ARGS) so the flag name and
value are always passed as two separate quoted tokens, eliminating
word-splitting and command-substitution risks.
Signed-off-by: SachinduNethmin <108050026+Sachindu-Nethmin@users.noreply.github.com>
---------
Signed-off-by: SachinduNethmin <108050026+Sachindu-Nethmin@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .github/workflows/auto-close.yml
+18-2Lines changed: 18 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,11 @@ on:
24
24
options:
25
25
- 'false'
26
26
- 'true'
27
+
grace_period_minutes:
28
+
description: 'Grace period in minutes before a potential-duplicate issue is labelled duplicate and closed (overrides config). Leave empty to use the configured default.'
Copy file name to clipboardExpand all lines: README.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,6 +220,50 @@ Notes:
220
220
- `llm.api_key`can be omitted if `GEMINI_API_KEY` is set.
221
221
- You can override the model at runtime with `LLM_MODEL`.
222
222
223
+
### `simili auto-close`
224
+
225
+
Scan all open issues labelled `potential-duplicate` and close those whose grace period has expired with no human activity. Closed issues are relabelled from `potential-duplicate` → `duplicate`.
226
+
227
+
```bash
228
+
simili auto-close --repo owner/repo --grace-period-minutes 60
229
+
```
230
+
231
+
**Flags:**
232
+
- `--repo` (required): Target repository (`owner/name`); falls back to `GITHUB_REPOSITORY` env var
233
+
- `--grace-period-minutes`: Override the grace period in minutes for this run (see precedence below)
234
+
- `--dry-run`: Print what would be closed without making any changes
235
+
- `--config`: Path to `simili.yaml` (auto-discovered if omitted)
236
+
237
+
**Grace period precedence** (highest → lowest):
238
+
239
+
| Source | How to set |
240
+
|--------|-----------|
241
+
| `--grace-period-minutes` CLI flag | Pass at runtime — overrides everything |
242
+
| `auto_close.grace_period_hours` in `simili.yaml` | Persistent per-repo config |
243
+
| Built-in default | 72 hours (3 days) |
244
+
245
+
**`simili.yaml` configuration:**
246
+
247
+
```yaml
248
+
auto_close:
249
+
grace_period_hours: 48 # default: 72
250
+
dry_run: false
251
+
```
252
+
253
+
**Human activity signals** — any of these prevent auto-close:
254
+
1. A negative reaction (👎 or 😕) on the bot's triage comment by a non-bot user.
255
+
2. The issue was reopened by a human after the `potential-duplicate` label was applied.
256
+
3. A non-bot comment posted after the label was applied.
257
+
258
+
**GitHub Actions usage** — the `auto-close.yml` workflow runs daily at 10:00 UTC and can be triggered manually via `workflow_dispatch` with an optional `grace_period_minutes` input:
259
+
260
+
```yaml
261
+
# Trigger from GitHub UI or gh CLI:
262
+
gh workflow run auto-close.yml -f grace_period_minutes=60 -f dry_run=false
263
+
```
264
+
265
+
Leaving `grace_period_minutes` empty uses the value from `simili.yaml` (or the 72 h default).
0 commit comments