Epic auto-close workflow (bdfinst/agentic-dev-team)
The Epic auto-close workflow from bdfinst/agentic-dev-team, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Epic auto-close workflow from the bdfinst/agentic-dev-team 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
name: Epic auto-close
# Closes a parent/epic issue once every sub-issue is closed - GitHub itself
# doesn't (see scripts/epic_auto_close.py's docstring for the full
# rationale, #987). This workflow fires on every issue close and delegates
# the actual decision to that script - the workflow itself makes no
# decision, it only supplies --repo/--issue and lets the script's own
# no-op / close logic determine the outcome.
on:
issues:
types: [closed]
permissions:
issues: write
contents: read
concurrency:
# Repo-wide (not per-issue-number): two sub-issues of the same epic closing
# within seconds of each other must serialize against one another, or they
# race a TOCTOU window between "is the parent already closed?" and the
# actual close call. This workflow fires infrequently, so repo-wide
# serialization costs nothing in practice.
group: epic-auto-close-${{ github.repository }}
jobs:
auto-close-epic:
name: Auto-close epic when all sub-issues are closed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Close parent epic if every sub-issue is closed
env:
GH_TOKEN: ${{ github.token }}
run: |
python3 scripts/epic_auto_close.py \
--repo "${{ github.repository }}" \
--issue "${{ github.event.issue.number }}"
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: Epic auto-close # Closes a parent/epic issue once every sub-issue is closed - GitHub itself # doesn't (see scripts/epic_auto_close.py's docstring for the full # rationale, #987). This workflow fires on every issue close and delegates # the actual decision to that script - the workflow itself makes no # decision, it only supplies --repo/--issue and lets the script's own # no-op / close logic determine the outcome. on: issues: types: [closed] permissions: issues: write contents: read concurrency: # Repo-wide (not per-issue-number): two sub-issues of the same epic closing # within seconds of each other must serialize against one another, or they # race a TOCTOU window between "is the parent already closed?" and the # actual close call. This workflow fires infrequently, so repo-wide # serialization costs nothing in practice. group: epic-auto-close-${{ github.repository }} jobs: auto-close-epic: timeout-minutes: 30 name: Auto-close epic when all sub-issues are closed runs-on: latchkey-small steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v6 with: cache: 'pip' python-version: "3.x" - name: Close parent epic if every sub-issue is closed env: GH_TOKEN: ${{ github.token }} run: | python3 scripts/epic_auto_close.py \ --repo "${{ github.repository }}" \ --issue "${{ github.event.issue.number }}"
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. - Cache dependency installs on the setup step so they are served from cache.
- 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.