Close stale issues workflow (pixlcore/xyops)
The Close stale issues workflow from pixlcore/xyops, 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 issues workflow from the pixlcore/xyops repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: Close stale issues
on:
schedule:
- cron: "17 3 * * *"
workflow_dispatch:
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v10
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Issues only
days-before-issue-stale: 7
days-before-issue-close: 3
days-before-pr-stale: -1
days-before-pr-close: -1
stale-issue-label: stale
stale-issue-message: >
This issue has had no activity for 7 days, so it is being marked stale.
If there is still no follow-up in 3 more days, it will be closed automatically.
close-issue-message: >
Closing this issue because it has been stale for 3 days with no further activity.
# Never touch enhancements
exempt-issue-labels: enhancement
# Never touch assigned issues
exempt-all-issue-assignees: true
operations-per-run: 200The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Close stale issues on: schedule: - cron: "17 3 * * *" workflow_dispatch: jobs: stale: timeout-minutes: 30 runs-on: latchkey-small permissions: issues: write pull-requests: write steps: - uses: actions/stale@v10 with: repo-token: ${{ secrets.GITHUB_TOKEN }} # Issues only days-before-issue-stale: 7 days-before-issue-close: 3 days-before-pr-stale: -1 days-before-pr-close: -1 stale-issue-label: stale stale-issue-message: > This issue has had no activity for 7 days, so it is being marked stale. If there is still no follow-up in 3 more days, it will be closed automatically. close-issue-message: > Closing this issue because it has been stale for 3 days with no further activity. # Never touch enhancements exempt-issue-labels: enhancement # Never touch assigned issues exempt-all-issue-assignees: true operations-per-run: 200
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.