Skip to content
Latchkey

Download AMO signed unlisted package workflow (violentmonkey/violentmonkey)

The Download AMO signed unlisted package workflow from violentmonkey/violentmonkey, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, 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: violentmonkey/violentmonkey.github/workflows/amo-download.ymlLicense MITView source

What it does

This is the Download AMO signed unlisted package workflow from the violentmonkey/violentmonkey 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: Download AMO signed unlisted package

on:
  workflow_dispatch:
    inputs:
      version:
        required: true
  repository_dispatch:
    types:
      - amo_download

jobs:
  amo-download:
    if: ${{ github.event.client_payload.version || github.event.inputs.version }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: pnpm/action-setup@v6
      - uses: actions/setup-node@v6
        with:
          node-version-file: 'package.json'

      - name: Prepare
        run: pnpm i && node scripts/action-helper.js
        env:
          ACTION_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
          DISCORD_WEBHOOK_RELEASE: ${{ secrets.DISCORD_WEBHOOK_RELEASE }}
          VERSION: ${{ github.event.client_payload.version || github.event.inputs.version }}

      - name: Download signed file and upload to GitHub release
        run: |
          mkdir -p $TEMP_DIR/updates
          DEBUG=amo-upload BETA=1 node scripts/amo-upload.mjs
        env:
          AMO_KEY: ${{ secrets.AMO_KEY }}
          AMO_SECRET: ${{ secrets.AMO_SECRET }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Update updates.json
        uses: JamesIves/github-pages-deploy-action@4.1.0
        with:
          branch: updates
          folder: ${{ env.TEMP_DIR }}/updates
          commit-message: Update to ${{ env.VERSION }} 🚀

      - name: Upload assets
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          node -e 'import("./scripts/release-helper.mjs").then(({ uploadAssets }) => uploadAssets())';

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Download AMO signed unlisted package
 
on:
  workflow_dispatch:
    inputs:
      version:
        required: true
  repository_dispatch:
    types:
      - amo_download
 
jobs:
  amo-download:
    timeout-minutes: 30
    if: ${{ github.event.client_payload.version || github.event.inputs.version }}
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
      - uses: pnpm/action-setup@v6
      - uses: actions/setup-node@v6
        with:
          cache: 'npm'
          node-version-file: 'package.json'
 
      - name: Prepare
        run: pnpm i && node scripts/action-helper.js
        env:
          ACTION_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
          DISCORD_WEBHOOK_RELEASE: ${{ secrets.DISCORD_WEBHOOK_RELEASE }}
          VERSION: ${{ github.event.client_payload.version || github.event.inputs.version }}
 
      - name: Download signed file and upload to GitHub release
        run: |
          mkdir -p $TEMP_DIR/updates
          DEBUG=amo-upload BETA=1 node scripts/amo-upload.mjs
        env:
          AMO_KEY: ${{ secrets.AMO_KEY }}
          AMO_SECRET: ${{ secrets.AMO_SECRET }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
      - name: Update updates.json
        uses: JamesIves/github-pages-deploy-action@4.1.0
        with:
          branch: updates
          folder: ${{ env.TEMP_DIR }}/updates
          commit-message: Update to ${{ env.VERSION }} 🚀
 
      - name: Upload assets
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          node -e 'import("./scripts/release-helper.mjs").then(({ uploadAssets }) => uploadAssets())';
 

What changed

2 third-party actions are referenced by a movable tag. Pin them 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