Skip to content
Latchkey

close-stale-pr workflow (apple/axlearn)

The close-stale-pr workflow from apple/axlearn, 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.

Grade your own workflow free or run it on Latchkey →
Source: apple/axlearn.github/workflows/stale.ymlLicense Apache-2.0View source

What it does

This is the close-stale-pr workflow from the apple/axlearn repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: close-stale-pr

permissions:
  contents: read

on:
  schedule:
    - cron: "30 1 * * *" # Runs every day at 1:30 UTC

jobs:
  stale:
    permissions:
      actions: write
      issues: write
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v10
        with:
          days-before-stale: 60
          days-before-close: 7
          stale-pr-message: "This pull request has been automatically marked as stale because it has been inactive for 60 days. It will be closed in 7 days if no further activity occurs. If you would like to continue working on this, please remove the `stale` label or leave a comment."
          close-pr-message: "This pull request was closed because it has been inactive for more than 7 days since being marked as stale. Please feel free to reopen it if you would like to continue."
          exempt-pr-labels: "ready-to-merge"
          stale-pr-label: "stale"

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: close-stale-pr
 
permissions:
  contents: read
 
on:
  schedule:
    - cron: "30 1 * * *" # Runs every day at 1:30 UTC
 
jobs:
  stale:
    timeout-minutes: 30
    permissions:
      actions: write
      issues: write
      pull-requests: write
    runs-on: latchkey-small
    steps:
      - uses: actions/stale@v10
        with:
          days-before-stale: 60
          days-before-close: 7
          stale-pr-message: "This pull request has been automatically marked as stale because it has been inactive for 60 days. It will be closed in 7 days if no further activity occurs. If you would like to continue working on this, please remove the `stale` label or leave a comment."
          close-pr-message: "This pull request was closed because it has been inactive for more than 7 days since being marked as stale. Please feel free to reopen it if you would like to continue."
          exempt-pr-labels: "ready-to-merge"
          stale-pr-label: "stale"
 

What changed

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow