update workflow (mingrammer/go-web-framework-stars)
The update workflow from mingrammer/go-web-framework-stars, 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.
What it does
This is the update workflow from the mingrammer/go-web-framework-stars 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: update
on:
schedule:
- cron: "0 0 * * SUN"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: "master"
- uses: actions/setup-go@v5
with:
go-version: "1.21.x"
- name: Create access token file
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "$GITHUB_TOKEN" > access_token.txt
- name: Run update script
run: go run list2md.go
- name: Update the list
env:
GITHUB_USER: "mingrammer"
GITHUB_EMAIL: "mingrammer@gmail.com"
run: |
git config user.name "${GITHUB_USER}"
git config user.email "${GITHUB_EMAIL}"
git add -A
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "chore: auto update"
git push
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: update on: schedule: - cron: "0 0 * * SUN" workflow_dispatch: jobs: build: timeout-minutes: 30 runs-on: latchkey-small permissions: contents: write steps: - uses: actions/checkout@v4 with: ref: "master" - uses: actions/setup-go@v5 with: go-version: "1.21.x" - name: Create access token file env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: echo "$GITHUB_TOKEN" > access_token.txt - name: Run update script run: go run list2md.go - name: Update the list env: GITHUB_USER: "mingrammer" GITHUB_EMAIL: "mingrammer@gmail.com" run: | git config user.name "${GITHUB_USER}" git config user.email "${GITHUB_EMAIL}" git add -A if git diff --staged --quiet; then echo "No changes to commit" exit 0 fi git commit -m "chore: auto update" git push
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.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.