tagpr workflow (x-motemen/ghq)
The tagpr workflow from x-motemen/ghq, explained and optimized by Latchkey.
A
CI health: A - excellent
Point runs-on at Latchkey and get run de-duplication, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the tagpr workflow from the x-motemen/ghq 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: tagpr
on:
push:
branches:
- "master"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: read
jobs:
tagpr:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: setup go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
- name: tagpr
id: tagpr
uses: Songmu/tagpr@e84001bd5dac8defa0c75b3913937d284a3b3660 # v1.20.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/release
with:
tag: ${{ steps.tagpr.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
if: "steps.tagpr.outputs.tag != ''"
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: tagpr on: push: branches: - "master" workflow_dispatch: permissions: contents: write pull-requests: write issues: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: tagpr: timeout-minutes: 20 runs-on: latchkey-small steps: - name: checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: setup go uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 with: go-version-file: go.mod - name: tagpr id: tagpr uses: Songmu/tagpr@e84001bd5dac8defa0c75b3913937d284a3b3660 # v1.20.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: ./.github/actions/release with: tag: ${{ steps.tagpr.outputs.tag }} token: ${{ secrets.GITHUB_TOKEN }} if: "steps.tagpr.outputs.tag != ''"
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. - Cancel superseded runs when a branch or PR gets a newer push.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.