Skip to content
Latchkey

Close empty issues and templates workflow (anuraghazra/github-readme-stats)

The Close empty issues and templates workflow from anuraghazra/github-readme-stats, 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: anuraghazra/github-readme-stats.github/workflows/empty-issues-closer.ymlLicense MITView source

What it does

This is the Close empty issues and templates workflow from the anuraghazra/github-readme-stats 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 empty issues and templates
on:
  issues:
    types:
      - reopened
      - opened
      - edited

permissions:
  actions: read
  checks: read
  contents: read
  deployments: read
  issues: write
  discussions: read
  packages: read
  pages: read
  pull-requests: read
  repository-projects: read
  security-events: read
  statuses: read

jobs:
  closeEmptyIssuesAndTemplates:
    if: github.repository == 'anuraghazra/github-readme-stats'
    name: Close empty issues
    runs-on: ubuntu-latest
    steps:
      # NOTE: Retrieve issue templates.
      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

      - name: Run empty issues closer action
        uses: rickstaa/empty-issues-closer-action@e96914613221511279ca25f50fd4acc85e331d99 # v1.1.74
        env:
          github_token: ${{ secrets.GITHUB_TOKEN }}
        with:
          close_comment:
            Closing this issue because it appears to be empty. Please update the
            issue for it to be reopened.
          open_comment:
            Reopening this issue because the author provided more information.
          check_templates: true
          template_close_comment:
            Closing this issue since the issue template was not filled in.
            Please provide us with more information to have this issue reopened.
          template_open_comment:
            Reopening this issue because the author provided more information.

The same workflow, on Latchkey

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

name: Close empty issues and templates
on:
  issues:
    types:
      - reopened
      - opened
      - edited
 
permissions:
  actions: read
  checks: read
  contents: read
  deployments: read
  issues: write
  discussions: read
  packages: read
  pages: read
  pull-requests: read
  repository-projects: read
  security-events: read
  statuses: read
 
jobs:
  closeEmptyIssuesAndTemplates:
    timeout-minutes: 30
    if: github.repository == 'anuraghazra/github-readme-stats'
    name: Close empty issues
    runs-on: latchkey-small
    steps:
      # NOTE: Retrieve issue templates.
      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
 
      - name: Run empty issues closer action
        uses: rickstaa/empty-issues-closer-action@e96914613221511279ca25f50fd4acc85e331d99 # v1.1.74
        env:
          github_token: ${{ secrets.GITHUB_TOKEN }}
        with:
          close_comment:
            Closing this issue because it appears to be empty. Please update the
            issue for it to be reopened.
          open_comment:
            Reopening this issue because the author provided more information.
          check_templates: true
          template_close_comment:
            Closing this issue since the issue template was not filled in.
            Please provide us with more information to have this issue reopened.
          template_open_comment:
            Reopening this issue because the author provided more information.
 

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