Skip to content
Latchkey

Generate Sponsors workflow (tw-in-js/twind)

The Generate Sponsors workflow from tw-in-js/twind, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: tw-in-js/twind.github/workflows/generate-sponsors.ymlLicense MITView source

What it does

This is the Generate Sponsors workflow from the tw-in-js/twind 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: Generate Sponsors

on:
  workflow_dispatch:
  schedule:
    # run every 5 days at 4:03 am
    - cron: '3 4 */5 * *'

jobs:
  update-sponsors:
    runs-on: ubuntu-latest
    if: github.repository == 'tw-in-js/twind'
    steps:
      - name: 📥  Checkout
        uses: actions/checkout@v3

      - name: 🔧  Setup
        uses: ./.github/actions/setup
        with:
          installArgs: --filter="." --filter="./scripts"

      - name: Update sponsors
        run: pnpm run sponsors
        working-directory: scripts
        env:
          SPONSORKIT_GITHUB_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
          SPONSORKIT_OPENCOLLECTIVE_KEY: ${{ secrets.OPENCOLLECTIVE_KEY }}

      - name: Commit
        uses: EndBug/add-and-commit@v9
        with:
          message: 'chore: update sponsors images'
          add: 'sites/twind.style/static/sponsors.*'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Generate Sponsors
 
on:
  workflow_dispatch:
  schedule:
    # run every 5 days at 4:03 am
    - cron: '3 4 */5 * *'
 
jobs:
  update-sponsors:
    timeout-minutes: 30
    runs-on: latchkey-small
    if: github.repository == 'tw-in-js/twind'
    steps:
      - name: 📥  Checkout
        uses: actions/checkout@v3
 
      - name: 🔧  Setup
        uses: ./.github/actions/setup
        with:
          installArgs: --filter="." --filter="./scripts"
 
      - name: Update sponsors
        run: pnpm run sponsors
        working-directory: scripts
        env:
          SPONSORKIT_GITHUB_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
          SPONSORKIT_OPENCOLLECTIVE_KEY: ${{ secrets.OPENCOLLECTIVE_KEY }}
 
      - name: Commit
        uses: EndBug/add-and-commit@v9
        with:
          message: 'chore: update sponsors images'
          add: 'sites/twind.style/static/sponsors.*'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

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