This file provides guidance for AI coding agents working in this repository.
setup-firefox is a GitHub Action that installs Firefox on GitHub Actions runners. It supports stable, beta, devedition, nightly, and ESR releases, as well as specific version numbers.
pnpm install --frozen-lockfile # install dependencies
pnpm lint # lint with Biome (CI mode, no auto-fix)
pnpm lint:fix # lint with auto-fix
pnpm test # run all unit tests with Vitest
pnpm test -- --reporter=verbose # verbose test output
npx vitest run __test__/<file>.test.ts # run a single test file
pnpm build # compile TypeScript → dist/index.js
pnpm package # copy action.yml + README.md into dist/src/
index.ts # action entry point: reads inputs, invokes installer, sets outputs
platform.ts # OS/arch detection → Platform struct
versions.ts # version alias resolution (latest, latest-beta, latest-esr, etc.)
DownloadURL.ts # constructs the download URL for a given version and platform
DownloadURLFactory.ts # factory that picks the right DownloadURL strategy for a version spec
installers.ts # installer registry: maps platform to the right installer class
LinuxInstaller.ts # Firefox installer for Linux
MacOSInstaller.ts # Firefox installer for macOS
WindowsInstaller.ts # Firefox installer for Windows
firefoxUtils.ts # shared utilities (e.g. finding the installed binary)
errors.ts # custom error types
__test__/
DownloadURL.test.ts # tests for URL construction
DownloadURLFactory.test.ts # tests for URL factory dispatch
installers.test.ts # tests for installer selection
action.yml # action metadata: inputs, outputs, runs.using: node24
biome.json # linter/formatter config
Version resolution and download URL construction are separated:
versions.tsresolves alias strings (e.g.latest-beta) to actual release version numbers by querying the Mozilla release API.DownloadURLFactory.tspicks the rightDownloadURLstrategy for the resolved version and platform.- Platform-specific installer classes (
LinuxInstaller,MacOSInstaller,WindowsInstaller) handle download, extraction, and PATH setup.
Tests live in __test__/ and use Vitest.
- Tests mock network/HTTP calls; no real requests are made at test time.
- When adding support for a new version alias or platform, add or update the corresponding test file.
- TypeScript strict mode — all types must be explicit; avoid
any. - Linter: Biome — run
pnpm lintbefore committing.useLiteralKeysandnoUselessElserules are disabled. - Formatter: Biome with space indentation.
- Node.js ≥ 24 is required.
- Conventional Commits are required for all commits (
feat:,fix:,chore:, etc.). - Never commit
dist/— it is built by CI and deployed to thelatestbranch on release. - The
action.ymlmainfield points toindex.jsinsidedist/, not the TypeScript source.