Skip to content

chore(ci): add PR autocloser#490

Merged
jdx merged 1 commit into
mainfrom
chore/add-pr-closer
May 17, 2026
Merged

chore(ci): add PR autocloser#490
jdx merged 1 commit into
mainfrom
chore/add-pr-closer

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented May 17, 2026

Summary

  • add a scheduled PR autocloser workflow
  • close inactive PRs after 7 days only when they have failing checks or merge conflicts
  • keep exclusions for @jdx-authored and keep-open PRs

Validation

  • actionlint .github/workflows/pr-closer.yml
  • git diff --check
  • jq filter sample validation

Note

Medium Risk
Automates closing pull requests via the GitHub API based on status/merge state; misclassification or query mistakes could close PRs unexpectedly, though it’s limited to stale PRs and excludes keep-open and jdx-authored PRs.

Overview
Adds a new scheduled/dispatchable GitHub Actions workflow (pr-closer) that scans for open PRs not updated in ~7 days (excluding jdx-authored, keep-open, and draft PRs) and automatically closes those with failing checks and/or merge conflicts.

PRs with cancelled checks or unknown merge state are only logged (skipped), and the workflow runs with minimal PR/check/status read/write permissions plus concurrency to prevent overlapping runs.

Reviewed by Cursor Bugbot for commit bcfb2e7. Bugbot is set up for automated code reviews on this repo. Configure here.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 17, 2026

Greptile Summary

Adds a new daily GitHub Actions workflow (pr-closer) that finds open, non-draft PRs inactive for 7+ days (excluding @jdx-authored and keep-open-labeled ones) and closes those with failing checks and/or merge conflicts, while only logging a warning for cancelled-check or unknown-merge-state cases.

  • The CUTOFF date math is correct: date -d '6 days ago' produces a date such that updated:<$CUTOFF matches PRs last touched 7+ days ago, consistent with the "at least 7 days" closing comment.
  • The jq pipeline handles null statusCheckRollup safely via // [] fallbacks, and gh pr close failures are caught with || echo \"Warning: ...\" so a transient error on one PR doesn't abort the rest of the batch.
  • Permissions are minimal and appropriately scoped; concurrency: cancel-in-progress: true prevents overlapping scheduled runs.

Confidence Score: 5/5

Safe to merge — the workflow is well-scoped, uses minimal permissions, and correctly handles partial failures.

The workflow logic is sound: the date math correctly targets PRs inactive for 7+ days, the jq pipeline is null-safe, the || echo guard prevents a single close failure from aborting the batch, and exclusions for the repo owner and keep-open label are in place. Both issues flagged in the previous review round have been addressed.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/pr-closer.yml New scheduled workflow that auto-closes inactive open PRs (≥7 days, non-draft, non-jdx, no keep-open label) that have failing checks or merge conflicts; jq logic is null-safe, the close command has proper error handling, and permissions are correctly scoped.

Reviews (4): Last reviewed commit: "chore(ci): add PR autocloser" | Re-trigger Greptile

Comment thread .github/workflows/pr-closer.yml Outdated
Comment thread .github/workflows/pr-closer.yml Outdated
@jdx jdx force-pushed the chore/add-pr-closer branch 2 times, most recently from 02c9a75 to 9a75e30 Compare May 17, 2026 16:06
@jdx jdx force-pushed the chore/add-pr-closer branch from 9a75e30 to bcfb2e7 Compare May 17, 2026 16:17
@jdx jdx enabled auto-merge (squash) May 17, 2026 16:31
@jdx jdx merged commit 80516ad into main May 17, 2026
14 of 20 checks passed
@jdx jdx deleted the chore/add-pr-closer branch May 17, 2026 16:38
This was referenced May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant