Close Stale Pull Requests workflow (TorchSim/torch-sim)
The Close Stale Pull Requests workflow from TorchSim/torch-sim, explained and optimized by Latchkey.
A
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Close Stale Pull Requests workflow from the TorchSim/torch-sim repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: 'Close Stale Pull Requests'
on:
schedule:
# Run every day at midnight UTC
- cron: '0 0 * * *'
jobs:
stale-pull-requests:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: -1 # Disable issue staleness, only manage PRs
days-before-pr-stale: 35 # Days of inactivity before marking as stale
days-before-pr-close: 7 # Days of inactivity after 'stale' label before closing
stale-pr-message: 'This pull request has been marked as stale because it has been inactive for more than 5 weeks. Please update it or it will be automatically closed in 30 days.'
close-pr-message: 'This pull request has been automatically closed due to prolonged inactivity. Please reopen if you still intend to submit this PR.'
stale-pr-label: 'stale' # Label to apply when marking as stale
exempt-pr-labels: 'keep-open' # Labels that exempt a PR from being marked stale
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: 'Close Stale Pull Requests' on: schedule: # Run every day at midnight UTC - cron: '0 0 * * *' jobs: stale-pull-requests: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-issue-stale: -1 # Disable issue staleness, only manage PRs days-before-pr-stale: 35 # Days of inactivity before marking as stale days-before-pr-close: 7 # Days of inactivity after 'stale' label before closing stale-pr-message: 'This pull request has been marked as stale because it has been inactive for more than 5 weeks. Please update it or it will be automatically closed in 30 days.' close-pr-message: 'This pull request has been automatically closed due to prolonged inactivity. Please reopen if you still intend to submit this PR.' stale-pr-label: 'stale' # Label to apply when marking as stale exempt-pr-labels: 'keep-open' # Labels that exempt a PR from being marked stale
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.