Skip to content
Latchkey

Close issues workflow (facebook/jest)

The Close issues workflow from facebook/jest, 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: facebook/jest.github/workflows/issues.ymlLicense MITView source

What it does

This is the Close issues workflow from the facebook/jest 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 issues'

on:
  issues:
    types: [labeled]

permissions:
  issues: write # to close issues (peter-evans/close-issue)

jobs:
  questions:
    name: Questions
    runs-on: ubuntu-latest
    steps:
      - if: "${{ github.event.label.name == ':speech_balloon: Question' }}"
        run: gh issue close $ISSUE --comment "Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/jestjs) or our [discord channel](https://discord.gg/j6FKKQQrW9) for questions."
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ISSUE: ${{ github.event.issue.html_url }}
  bug-without-repro:
    name: Bug reports without reproductions
    runs-on: ubuntu-latest
    steps:
      - if: "${{ github.event.label.name == 'Needs Reproduction' }}"
        run: gh issue close $ISSUE --comment "As noted in the [Bug Report template](https://github.com/jestjs/jest/blob/main/.github/ISSUE_TEMPLATE/bug.yml), all bug reports requires a minimal reproduction. Please open up a new issue providing one. Read more at https://stackoverflow.com/help/minimal-reproducible-example."
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ISSUE: ${{ github.event.issue.html_url }}

The same workflow, on Latchkey

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

name: 'Close issues'
 
on:
  issues:
    types: [labeled]
 
permissions:
  issues: write # to close issues (peter-evans/close-issue)
 
jobs:
  questions:
    timeout-minutes: 30
    name: Questions
    runs-on: latchkey-small
    steps:
      - if: "${{ github.event.label.name == ':speech_balloon: Question' }}"
        run: gh issue close $ISSUE --comment "Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/jestjs) or our [discord channel](https://discord.gg/j6FKKQQrW9) for questions."
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ISSUE: ${{ github.event.issue.html_url }}
  bug-without-repro:
    timeout-minutes: 30
    name: Bug reports without reproductions
    runs-on: latchkey-small
    steps:
      - if: "${{ github.event.label.name == 'Needs Reproduction' }}"
        run: gh issue close $ISSUE --comment "As noted in the [Bug Report template](https://github.com/jestjs/jest/blob/main/.github/ISSUE_TEMPLATE/bug.yml), all bug reports requires a minimal reproduction. Please open up a new issue providing one. Read more at https://stackoverflow.com/help/minimal-reproducible-example."
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ISSUE: ${{ github.event.issue.html_url }}
 

What changed

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