The Simplest Way to Make GitHub Actions and Mercurial Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use github actions and mercurial to run automated builds on Mercurial codebases. A workflow runner pulls your Mercurial repo, runs tests, and pushes build artifacts. Many engineering groups keep legacy or large projects in Mercurial repos. At the same time, they want to use modern workflow runners for testing. Linking these two tools lets developers keep their favorite version control system. They also get fast cloud builds without moving all their code to Git. How github actions and me

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use github actions and mercurial to run automated builds on Mercurial codebases. A workflow runner pulls your Mercurial repo, runs tests, and pushes build artifacts.

Many engineering groups keep legacy or large projects in Mercurial repos. At the same time, they want to use modern workflow runners for testing. Linking these two tools lets developers keep their favorite version control system. They also get fast cloud builds without moving all their code to Git.

How github actions and mercurial share keys and data

GitHub runners expect Git repos by default during a normal job run. To use Mercurial, the job must first install the Mercurial client tool. Then the runner uses a stored secret key to log in. It pulls the needed changeset from your remote Mercurial server over SSH or HTTPS.

Data flows in one direction during most standard test and build jobs. The remote Mercurial server sends source files to the ephemeral runner machine. The runner compiles the app, runs unit tests, and checks code rules. When the job finishes, the runner sends status reports back to the main dashboard.

You can trigger these workflow runs in a few simple ways. Your Mercurial server can send a webhook payload after every developer push. That payload tells the workflow API to start a fresh build job. You can also set up a timer to pull changes every hour.

Common failure modes and how to scope runner roles

The biggest risk in this setup comes from shared service accounts. Teams often create one broad SSH key with full write permissions. They store this single key in the workflow secret store for all jobs. If a bad script runs in a build, it can read that key. Then an attacker can change code across every Mercurial repo you own.

Unlogged repo pulls also cause hard problems for security and audit teams. When ten workflows share one bot user, the server log shows one name. You cannot tell which job or developer pulled a private repo. Broad network rules make this worse by opening the Mercurial server to all IPs.

GitHub Actions Security + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, give each workflow its own read-only key or role. Never give a test runner write permissions unless it tags a release. Scope each key so it can only read one specific Mercurial project. Rotate these secrets on a regular schedule to limit exposure from old keys.

You should also lock down the network path between the two tools. Put your Mercurial server behind a private network and use self-hosted runners. That way, source code stays inside your private cloud during every build. Check your server logs often to track which runner pulls each repo.

Best practices for fast Mercurial builds in cloud runners

Large Mercurial repos can take a long time to clone from scratch. A fresh cloud runner starts with an empty disk on every single run. Pulling gigabytes of history over the network wastes both time and money. It also puts heavy load on your central Mercurial server during busy hours.

You can speed up builds by caching the local Mercurial store folder. Save the repo cache between runs based on a hash of your branch. When the next job starts, it restores the cache from local storage. Then it only pulls the newest changesets instead of the whole project history.

Keep your runner images clean and pin the exact Mercurial tool version. Version mismatches between the server and client can break cache files. A small custom runner image with Mercurial pre-installed saves setup time on every run.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Can a workflow runner pull from a Mercurial repo without converting to Git?

Yes, the runner just needs the Mercurial client installed during the job. It can run standard pull commands directly against your remote Mercurial server.

How do we trigger a build when a developer pushes to Mercurial?

Set up an incoming webhook hook on your Mercurial server after each push. Have that hook send an API request to start the workflow run.

Should build runners use SSH keys or tokens for Mercurial?

Use read-only tokens or scoped SSH deploy keys for each single project. Avoid personal user accounts so team changes do not break your builds.

The query runs. The emails stay hidden.