Using a GitHub-hosted runner
To use a GitHub-hosted runner, create a job and use runs-on
to specify the type of runner that will process the job, such as ubuntu-latest
, windows-latest
, or macos-latest
. For the full list of runner types, see GitHub-hosted runners reference. If you have repo: write
access to a repository, you can view a list of the runners available to use in workflows in the repository. For more information, see Viewing available runners for a repository.
When the job begins, GitHub automatically provisions a new VM for that job. All steps in the job execute on the VM, allowing the steps in that job to share information using the runner's filesystem. You can run workflows directly on the VM or in a Docker container. When the job has finished, the VM is automatically decommissioned.
The following diagram demonstrates how two jobs in a workflow are executed on two different GitHub-hosted runners.
The following example workflow has two jobs, named Run-npm-on-Ubuntu
and Run-PSScriptAnalyzer-on-Windows
. When this workflow is triggered, GitHub provisions a new virtual machine for each job.
- The job named
Run-npm-on-Ubuntu
is executed on a Linux VM, because the job'sruns-on:
specifiesubuntu-latest
. - The job named
Run-PSScriptAnalyzer-on-Windows
is executed on a Windows VM, because the job'sruns-on:
specifieswindows-latest
.
name: Run commands on different operating systems on: push: branches: [ main ] pull_request: branches: [ main ] jobs: Run-npm-on-Ubuntu: name: Run npm on Ubuntu runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '14' - run: npm help Run-PSScriptAnalyzer-on-Windows: name: Run PSScriptAnalyzer on Windows runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: Install PSScriptAnalyzer module shell: pwsh run: | Set-PSRepository PSGallery -InstallationPolicy Trusted Install-Module PSScriptAnalyzer -ErrorAction Stop - name: Get list of rules shell: pwsh run: | Get-ScriptAnalyzerRule
name: Run commands on different operating systems
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
Run-npm-on-Ubuntu:
name: Run npm on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '14'
- run: npm help
Run-PSScriptAnalyzer-on-Windows:
name: Run PSScriptAnalyzer on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install PSScriptAnalyzer module
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module PSScriptAnalyzer -ErrorAction Stop
- name: Get list of rules
shell: pwsh
run: |
Get-ScriptAnalyzerRule
While the job runs, the logs and output can be viewed in the GitHub UI:
La aplicación ejecutora de GitHub Actions es de código abierto. Puede contribuir y presentar incidencias en el repositorio runner.
Viewing available runners for a repository
Si tienes acceso repo: write
a un repositorio, puedes ver una lista de los ejecutores disponibles para el repositorio.
-
En GitHub, navegue hasta la página principal del repositorio.
-
En el nombre del repositorio, haz clic en Acciones.
-
En la barra lateral izquierda, en la sección "Administración", haz clic en Ejecutores.
-
Review the list of available GitHub-hosted runners for the repository.
-
Opcionalmente, para copiar la etiqueta de un ejecutor para usarla en un flujo de trabajo, haz clic en a la derecha del ejecutor y, a continuación, haz clic en Copiar etiqueta.
Nota:
Los propietarios de empresa y de la organización y los usuarios con el permiso "Manage organization runners and runner groups" pueden crear ejecutores desde esta página. Para crear un nuevo ejecutor, haz clic en Nuevo ejecutor en la parte superior derecha de la lista de ejecutores para agregar ejecutores al repositorio.
Para obtener más información, consulta Managing larger runners y Adding self-hosted runners. Para obtener más información sobre los roles de organización personalizados, consulta Acerca de los roles personalizados de organización.