Running a job on every runner in parallel

At present, when a job runs, it picks the most suitable runner for the job based on labels and repository (Using self-hosted runners in a workflow - GitHub Docs). My question is whether it is possible to run a single job on every runner that’s meets the requirements of a job.

For example, I have multiple runners, both self-hosted and hosted by Github; I have a job that contains a script that does the following when code is pushed to the repo:

  • Checks out the Git repo using actions/checkout@v2
  • Copies a file from the checked out repo to a user’s home directory

This “action” needs to take place on every runner that the action has access to.

I hope this makes sense!

It’s not directly possible to send a single job instance to all the available runners.

The job is sent to the first available runner in self-hosted runners and hosted runners that match the label conditions and is online and idle.

So if you want to run the same job on every runner, you could queue multiple jobs using matrix strategy.

This sounds like you’re trying to have the runner act as an automated management tool. Don’t do that. Runners are meant to run tasks and report results back, not to run tasks on specific machines, and you don’t have control over which specific machine a job runs on (at least not beyond groups).

Instead, you can have one runner run an automated management tool that deploys files or whatever else you need to do. Ansible is one option that I’m using both at work and for personal systems, and it’s already installed on GitHub runners (at least on Ubuntu, I didn’t check the others).