Per-branch RunsOn environments
If you have 2 environments â e.g. production (default) and dev (per-branch), you can target a specific one based on e.g. branch names by dynamically assigning a value to the env â label:
Example:
example-job: name: Example Job runs-on: - runs-on=${{ github.run\_id }}-${{ github.run\_attempt }}-example-job - env=${{ contains(vars.RUNS\_ON\_DEV\_BRANCHES || '', github.ref\_name) && 'dev' || 'production' }}Then setting a repo var RUNS_ON_DEV_BRANCHES to include branch names you want to specifically run on dev.
Especially useful when you want to test RunsOn upgrades without impacting the main branches: spin-up a new dev stack, update the RUNS_ON_DEV_BRANCHES value, and test your workflows in an isolated branch of your repositories.
Last updated: October 22, 2025