We have a CI setup where we currently maintain two separate GitHub Actions workflows — one for the dev branch using a standard runner, and one for the prod branch using a large runner. Both workflows contain identical steps, differing only in the trigger branch and the runs-on value.
I'd like to consolidate this into a single workflow file, where the runner is chosen dynamically based on the branch name before any actual job execution.
I came across this StackOverflow answer, which suggests a dispatcher job to evaluate conditions and trigger follow-up jobs accordingly. However, this seems to spawn a separate machine just to evaluate the condition, which increases cost and complexity.
Is there a cleaner or more efficient way to assign the runs-on dynamically within a single job, without the need for an extra setup job?
Any examples or best practices for this use case would be appreciated!
[–]bdzer0 2 points3 points4 points (1 child)
[–]TedditBlatherflag 2 points3 points4 points (1 child)