Skip to content

chore(ci): improve pr-closer workflow#9403

Merged
jdx merged 1 commit intomainfrom
pr-closer-improvements
Apr 26, 2026
Merged

chore(ci): improve pr-closer workflow#9403
jdx merged 1 commit intomainfrom
pr-closer-improvements

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 26, 2026

Summary

  • Backports improvements made to the same workflow in chore: add pr-closer workflow hk#876.
  • Adds explicit permissions: pull-requests: write so the job can't 403 on read-only default tokens.
  • Replaces hardcoded jdx/mise with ${{ github.repository }} (via REPO env).
  • Filters stale PRs server-side via --search "updated:<CUTOFF -author:jdx -label:keep-open sort:updated-asc" and bumps --limit to 500. Only stale candidates are fetched, sorted oldest-first, so anything beyond the limit rolls into the next daily run instead of being silently skipped.

Test plan

  • Verified the search query against jdx/mise — currently returns 0 stale candidates (workflow has been keeping things tidy)
  • Trigger via workflow_dispatch once merged to confirm a clean run

🤖 Generated with Claude Code


Note

Low Risk
Low risk: limited to a GitHub Actions workflow and only changes how stale PRs are queried/closed; main risk is mis-filtering PRs and closing the wrong ones.

Overview
Improves the pr-closer GitHub Actions workflow by granting explicit pull-requests: write permissions and removing the hardcoded repository in favor of ${{ github.repository }}.

Changes stale-PR selection to be filtered server-side using a date cutoff search (sorted oldest-first) and increases the fetch limit to 500 before closing candidates, while keeping the “failing vs passing checks” close message behavior.

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

- Add explicit `permissions: pull-requests: write` so the job won't 403 on read-only default tokens.
- Replace hardcoded `jdx/mise` with `${{ github.repository }}` (via REPO env).
- Filter stale PRs server-side via `--search "updated:<CUTOFF -author:jdx -label:keep-open sort:updated-asc"` and bump `--limit` to 500. Only stale candidates are fetched, sorted oldest-first, and any beyond the limit roll into the next daily run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@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
Contributor

greptile-apps Bot commented Apr 26, 2026

Greptile Summary

This PR hardens the stale-PR-closer workflow by adding an explicit pull-requests: write permission (preventing 403s with read-only default tokens), making the repository reference dynamic via $REPO, and moving all staleness filtering (cutoff date, author exclusion, label exclusion) server-side so the client only processes genuine candidates up to a 500-item limit.

Confidence Score: 4/5

Safe to merge — only one P2 style note about a sort qualifier that degrades gracefully.

All changes are straightforward CI hardening with no logic regressions. The only finding is a P2: sort:updated-asc embedded in the --search string is likely ignored by the GitHub API, meaning PRs are closed in an unspecified order rather than oldest-first. This does not affect correctness.

.github/workflows/pr-closer.yml — minor sort-qualifier concern on line 20.

Important Files Changed

Filename Overview
.github/workflows/pr-closer.yml CI workflow improved: adds explicit pull-requests: write permission, replaces hardcoded repo with $REPO env var, moves stale-PR filtering server-side via --search, and bumps limit to 500. One minor concern: sort:updated-asc in the search string is likely a no-op.

Fix All in Claude Code

Reviews (1): Last reviewed commit: "chore(ci): improve pr-closer workflow" | Re-trigger Greptile

([.labels[].name] | index("keep-open") | not)
) | [.number, (if (.statusCheckRollup | length > 0) and ([.statusCheckRollup[].conclusion] | index("FAILURE") or index("failure")) then "failing" else "passing" end)] | @tsv' | \
CUTOFF=$(date -u -d '30 days ago' +%Y-%m-%d)
gh pr list -R "$REPO" --state open --search "updated:<$CUTOFF -author:jdx -label:keep-open sort:updated-asc" --json number,statusCheckRollup --limit 500 | \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 sort:updated-asc may be silently ignored

The sort:updated-asc qualifier is embedded in the --search string, but GitHub's search API treats sort and order as separate query parameters, not inline search qualifiers. The gh pr list CLI does not appear to extract and re-map sort: tokens from the --search string, so this term is likely passed as a literal keyword and silently produces no effect. Closing PRs in unspecified order is harmless here (oldest-first is a nice-to-have, not a correctness requirement), but if ordered processing is important the --sort updated --order asc flags on gh pr list would be the reliable alternative.

Suggested change
gh pr list -R "$REPO" --state open --search "updated:<$CUTOFF -author:jdx -label:keep-open sort:updated-asc" --json number,statusCheckRollup --limit 500 | \
gh pr list -R "$REPO" --state open --search "updated:<$CUTOFF -author:jdx -label:keep-open" --sort updated --order asc --json number,statusCheckRollup --limit 500 | \

Fix in Claude Code

@github-actions
Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.22 x -- echo 22.4 ± 0.7 21.5 24.4 1.00
mise x -- echo 22.5 ± 0.6 21.7 31.4 1.00 ± 0.04

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.22 env 21.8 ± 1.0 20.9 30.0 1.00
mise env 22.2 ± 1.0 21.1 29.8 1.02 ± 0.07

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.22 hook-env 23.0 ± 0.9 21.7 31.7 1.00
mise hook-env 24.1 ± 1.0 22.4 30.1 1.05 ± 0.06

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.22 ls 22.5 ± 0.9 21.5 32.3 1.00
mise ls 23.4 ± 0.6 22.2 25.0 1.04 ± 0.05

xtasks/test/perf

Command mise-2026.4.22 mise Variance
install (cached) 165ms 170ms -2%
ls (cached) 79ms 83ms -4%
bin-paths (cached) 81ms 83ms -2%
task-ls (cached) 798ms 799ms +0%

@jdx jdx merged commit 41a8887 into main Apr 26, 2026
38 checks passed
@jdx jdx deleted the pr-closer-improvements branch April 26, 2026 16:20
jdx pushed a commit that referenced this pull request Apr 26, 2026
### 🚀 Features

- **(backend)** add global libc preference by @jdx in
[#9404](#9404)
- opt-in to pre-release versions for github and aqua backends by
@jakedgy in [#9329](#9329)

### 🐛 Bug Fixes

- **(backend)** allow unresolved latest opt-in by @jdx in
[#9401](#9401)
- **(install)** stop rewriting healthy runtime symlinks by @jdx in
[#9410](#9410)
- **(node)** route musl tarball URLs to unofficial-builds by @jdx in
[#9409](#9409)
- **(prune)** skip remote version resolution for tracked configs by @jdx
in [#9406](#9406)
- **(schema)** allow array values in tool additionalProperties by
@JP-Ellis in [#9400](#9400)

### 📦️ Dependency Updates

- bump communique to 1.1.2 by @jdx in
[#9402](#9402)

### 📦 Registry

- use aqua for rumdl by @scop in
[#9397](#9397)

### Chore

- **(ci)** improve pr-closer workflow by @jdx in
[#9403](#9403)
- **(release)** stop appending sponsor blurb when communique succeeds by
@jdx in [#9395](#9395)

### New Contributors

- @JP-Ellis made their first contribution in
[#9400](#9400)
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