I built a GitHub Action that works with any stack — here's how
Every time I clone a repo, I have to figure out how to run it.
This is fine for my own projects. But when I'm reviewing a PR, onboarding a new teammate, or setting up CI for a polyglot team, it becomes noise.
rex is a single Go binary that detects your project's stack and runs the right command. No config file. No reading the README.
git clone https://github.com/someone/unknown-project cd unknown-project rex test # it just works Enter fullscreen mode Exit fullscreen mode How it works under the hood The detection logic is surprisingly simple — and that's the point.
This happens in <50ms because it's just os.Stat calls — no network, no parsing heavy files.
Once the stack is known, rex maps standard verbs to the right tool:
// Go test -> "go test ./..." run -> "go run ./cmd/server" build -> "go build ./..." // Node (pnpm) test -> "pnpm test" run -> "pnpm run dev" build -> "pnpm run build" Enter fullscreen mode Exit fullscreen mode Step 3: Priority chain (the smart part) rex doesn't blindly guess. It respects what's already there:
1. Justfile / Makefile (task runner overrides everything) 2. package.json scripts / Cargo.toml / go.mod (ecosystem native) 3. Language heuristics (fallback) Enter fullscreen mode Exit fullscreen mode If a Makefile defines a test target, rex test runs make test — even in a Go project.
The most interesting part is how this became a GitHub Action.
Instead of requiring Go to be installed in the runner, the action downloads the correct binary directly from the release page:
- uses: rexrun-dev/rex@v0.4.0 with: command: test Enter fullscreen mode Exit fullscreen mode This single step replaces 10+ lines of stack-specific YAML. Works for all 12 supported languages.
I used GitHub's composite action type instead of Docker. Why?
The trade-off? The install script has to handle OS/arch detection:
OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) case "$ARCH" in x86_64) ARCH="amd64" ;; aarch64|arm64) ARCH="arm64" ;; esac URL="https://github.com/rexrun-dev/rex/releases/download/${VERSION}/rex_${VERSION#v}_${OS}_${ARCH}.tar.gz" curl -sL "$URL" | tar xz -C /usr/local/bin rex Enter fullscreen mode Exit fullscreen mode Watch mode A recent addition: rex watch polls the filesystem and re-runs your command on change.
rex watch test # re-run tests when files change rex watch build # re-build on change Enter fullscreen mode Exit fullscreen mode It's not using inotify or fsnotify — just a lightweight polling loop with hash-based change detection. This makes it portable across all platforms without CGO or platform-specific dependencies.
rex ci generates a GitHub Actions workflow file customized for your detected stack:
$ rex ci ✓ created .github/workflows/ci.yml (go project) Enter fullscreen mode Exit fullscreen mode The generated YAML uses the official setup actions for each language (setup-go, setup-node, setup-python, etc.) and runs the correct test command.
brew tap rexrun-dev/tap && brew install rex # or go install rexrun.dev/rex/cmd/rex@latest Enter fullscreen mode Exit fullscreen mode Or try the interactive playground at rexrun.dev — paste any GitHub repo URL and see what rex would detect.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
For further actions, you may consider blocking this person and/or reporting abuse
Thank you to our Diamond Sponsors for supporting the DEV Community
DEV Community — A space to discuss and keep up software development and manage your software career
Built on Forem — the open source software that powers DEV and other inclusive communities.
We're a place where coders share, stay up-to-date and grow their careers.
Original Source
This content was distilled for a focused reading experience. All rights belong to DEV Community.
Read original publication