Skip to content
Latchkey

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.

Grade your own workflow free or run it on Latchkey →
Source: mingrammer/go-web-framework-stars.github/workflows/main.ymlLicense MITView source

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

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

Actions used in this workflow