Prepare release PR workflow (Diaoul/subliminal)
The Prepare release PR workflow from Diaoul/subliminal, explained and optimized by Latchkey.
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 Prepare release PR workflow from the Diaoul/subliminal 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: Prepare release PR
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to base the release from'
required: false
default: 'main'
bump:
description: |
'Release type: major, minor or patch. '
'Leave empty for autommatic detection based on changelog segments.'
required: false
default: ''
prerelease:
description: 'Prerelease (ex: rc1). Leave empty if not a pre-release.'
required: false
default: ''
env:
FORCE_COLOR: "1"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
# persist-credentials is needed in order for us to push the release branch.
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: .python-version-default
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools tox
- name: Prepare release PR
env:
BRANCH: ${{ github.event.inputs.branch }}
BUMP: ${{ github.event.inputs.bump }}
PRERELEASE: ${{ github.event.inputs.prerelease }}
GH_TOKEN: ${{ github.token }}
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
tox -e prepare-release-pr -- ${BRANCH} --bump=${BUMP} --prerelease=${PRERELEASE}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Prepare release PR on: workflow_dispatch: inputs: branch: description: 'Branch to base the release from' required: false default: 'main' bump: description: | 'Release type: major, minor or patch. ' 'Leave empty for autommatic detection based on changelog segments.' required: false default: '' prerelease: description: 'Prerelease (ex: rc1). Leave empty if not a pre-release.' required: false default: '' env: FORCE_COLOR: "1" jobs: build: timeout-minutes: 30 runs-on: latchkey-small permissions: contents: write pull-requests: write steps: - uses: actions/checkout@v7 with: fetch-depth: 0 # persist-credentials is needed in order for us to push the release branch. persist-credentials: true - name: Set up Python uses: actions/setup-python@v6 with: python-version-file: .python-version-default cache: pip - name: Install dependencies run: | python -m pip install --upgrade pip pip install --upgrade setuptools tox - name: Prepare release PR env: BRANCH: ${{ github.event.inputs.branch }} BUMP: ${{ github.event.inputs.bump }} PRERELEASE: ${{ github.event.inputs.prerelease }} GH_TOKEN: ${{ github.token }} run: | git config user.name 'github-actions[bot]' git config user.email '41898282+github-actions[bot]@users.noreply.github.com' tox -e prepare-release-pr -- ${BRANCH} --bump=${BUMP} --prerelease=${PRERELEASE}
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.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.