Runners are the machines that execute jobs in a GitHub Actions workflow. For example, a runner can clone your repository locally, install testing software, and then run commands that evaluate your code.
GitHub provides runners that you can use to run your jobs, or you can host your own runners. Each GitHub-hosted runner is a new virtual machine (VM) hosted by GitHub with the runner application and other tools preinstalled, and is available with Ubuntu Linux, Windows, or macOS operating systems. When you use a GitHub-hosted runner, machine maintenance and upgrades are taken care of for you.
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
macos-latest. For the full list of runner types, see "Supported runners and hardware resources."
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-PSScriptAnalyzer-on-Windows. When this workflow is triggered, GitHub provisions a new virtual machine for each job.
- The job named
Run-npm-on-Ubuntuis executed on a Linux VM, because the job's
- The job named
Run-PSScriptAnalyzer-on-Windowsis executed on a Windows VM, because the job's
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@v3 - uses: actions/setup-node@v3 with: node-version: '14' - run: npm help Run-PSScriptAnalyzer-on-Windows: name: Run PSScriptAnalyzer on Windows runs-on: windows-latest steps: - uses: actions/checkout@v3 - 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:
GitHub Actions 运行器应用程序是开源的。 可以参与 runner 存储库并在其中提交问题。
Note: GitHub also offers 大型运行器s, which are available in larger configurations. For more information, see "Using 大型运行器s."
Hardware specification for Windows and Linux virtual machines:
- 2-core CPU (x86_64)
- 7 GB of RAM
- 14 GB of SSD space
Hardware specification for macOS virtual machines:
- 3-core CPU (x86_64)
- 14 GB of RAM
- 14 GB of SSD space
|Windows Server 2022||
|Windows Server 2019||
|Ubuntu 18.04 [已弃用]||
|macOS Monterey 12||
|macOS Big Sur 11||
|macOS Catalina 10.15 [已弃用]||
-latest 运行器映像是 GitHub 提供的最新稳定映像，但可能不是操作系统供应商提供的最新版本的操作系统。
注意：Beta 版映像和已弃用的映像“按原样提供”、“包含全部错误”且“视可用性情况”提供，不包含在服务级别协议和保证之内。 客户支持可能不会涵盖 Beta 版映像。
Workflow logs list the runner used to run a job. For more information, see "Viewing workflow run history."
The software tools included in GitHub-hosted runners are updated weekly. The update process takes several days, and the list of preinstalled software on the
main branch is updated after the whole deployment ends.
Workflow logs include a link to the preinstalled tools on the exact runner. To find this information in the workflow log, expand the
Set up job section. Under that section, expand the
Runner Image section. The link following
Included Software will describe the preinstalled tools on the runner that ran the workflow.
For more information, see "Viewing workflow run history."
For the overall list of included tools for each runner operating system, see the links below:
- Ubuntu 22.04 LTS
- Ubuntu 20.04 LTS
- Ubuntu 18.04 LTS (deprecated)
- Windows Server 2022
- Windows Server 2019
- macOS 12
- macOS 11
- macOS 10.15
GitHub-hosted runners include the operating system's default built-in tools, in addition to the packages listed in the above references. For example, Ubuntu and macOS runners include
which, among other default tools.
We recommend using actions to interact with the software installed on runners. This approach has several benefits:
- Usually, actions provide more flexible functionality like versions selection, ability to pass arguments, and parameters
- It ensures the tool versions used in your workflow will remain the same regardless of software updates
If there is a tool that you'd like to request, please open an issue at actions/runner-images. This repository also contains announcements about all major software updates on runners.
You can install additional software on GitHub-hosted runners. For more information, see "Customizing GitHub-hosted runners".
GitHub hosts Linux and Windows runners on
Standard_DS2_v2 virtual machines in Microsoft Azure with the GitHub Actions runner application installed. The GitHub-hosted runner application is a fork of the Azure Pipelines Agent. Inbound ICMP packets are blocked for all Azure virtual machines, so ping or traceroute commands might not work. For more information about the
Standard_DS2_v2 resources, see "Dv2 and DSv2-series" in the Microsoft Azure documentation.
GitHub hosts macOS runners in GitHub's own macOS Cloud.
如果 GitHub Actions 服务暂时不可用，则在触发后 30 分钟内没有排队时，运行的工作流程运行将被丢弃。 例如，如果触发了一个工作流程，而 GitHub Actions 服务在 31 分钟或更长时间内不可用，则该工作流程将不会被处理。
In addition, if the workflow run has been successfully queued, but has not been processed by a GitHub-hosted runner within 45 minutes, then the queued workflow run is discarded.
The Linux and macOS virtual machines both run using passwordless
sudo. When you need to execute commands or install tools that require more privileges than the current user, you can use
sudo without needing to provide a password. For more information, see the "Sudo Manual."
Windows virtual machines are configured to run as administrators with User Account Control (UAC) disabled. For more information, see "How User Account Control works" in the Windows documentation.
Note: If you use an IP address allow list for your GitHub organization or enterprise account, you cannot use GitHub-hosted runners and must instead use self-hosted runners. For more information, see "About self-hosted runners."
To get a list of IP address ranges that GitHub Actions uses for GitHub-hosted runners, you can use the GitHub REST API. For more information, see the
actions key in the response of the "Get GitHub meta information" endpoint.
Windows and Ubuntu runners are hosted in Azure and subsequently have the same IP address ranges as the Azure datacenters. macOS runners are hosted in GitHub's own macOS cloud.
Since there are so many IP address ranges for GitHub-hosted runners, we do not recommend that you use these as allow-lists for your internal resources.
The list of GitHub Actions IP addresses returned by the API is updated once a week.
GitHub executes actions and shell commands in specific directories on the virtual machine. The file paths on virtual machines are not static. Use the environment variables GitHub provides to construct file paths for the
|Contains user-related data. For example, this directory could contain credentials from a login attempt.|
|Actions and shell commands execute in this directory. An action can modify the contents of this directory, which subsequent actions can access.|
For a list of the environment variables GitHub creates for each workflow, see "Using environment variables."
Actions that run in Docker containers have static directories under the
/github path. However, we strongly recommend using the default environment variables to construct file paths in Docker containers.
GitHub reserves the
/github path prefix and creates three directories for actions.
/github/workspace- 注意： GitHub Actions 必须由默认 Docker 用户 (root) 运行。 确保 Dockerfile 没有设置