GitHub Actions Runner
repository·main·Indexed 27 days ago
https://github.com/actions/runnerThe core application that executes jobs defined in GitHub Actions workflows. It supports both GitHub-hosted environments and self-hosted infrastructure on Windows, macOS, and Linux. Documentation covers self-hosted runner setup, proxy configuration, problem matcher registration, shell execution options, and workflow expression properties like step outcome and conclusion.
What's inside actions-runner
- The GitHub Actions Runner is the application responsible for executing jobs from a GitHub Actions workflow. Runners are used by GitHub Actions in hosted virtual environments, or they can be self-hosted in your own environment to provide custom compute resources for your workflows.
Limitations of Container Hooks
mainContainer hooks have the following constraints:
- Platform Support: Hooks are only supported on Linux at launch.
- Runner Type: Hooks are configured by the runner administrator. Therefore, they are only supported on self-hosted runners.
Understand Composite Action Encapsulation
mainIn GitHub Actions, a composite action is treated as a single, encapsulated logical job step from the perspective of the workflow author. This means the internal implementation details of the composite action (such as specific shell configurations or working directories) are hidden from the consumer. The workflow author interacts with the composite action as one unit, and the action's internal settings should not be directly influenced by the workflow'sshellorworking-directorysettings.Capabilities and Support for Container Hooks
mainThe implementation of container hooks provides the following capabilities:
- Non-Docker Scenarios: Support for non-Docker scenarios on self-hosted runners, allowing customers to customize their Docker invocations.
- Troubleshooting: Telemetry is included to assist in troubleshooting support issues related to hooks.
Quickstart: Run a job from a real repository
mainTo build the runner from source and execute actions from a real GitHub repository, follow these steps. You will need your repository URL and a runner registration token (found at
https://github.com/{your-repo}/settings/actions/runners/new).Note: To ensure your job runs on this custom runner, set
runs-on: self-hostedin your workflow file.git clone https://github.com/actions/runner cd runner/src ./dev.(sh/cmd) layout # the runner that built from source is in {root}/_layout cd ../_layout ./config.(sh/cmd) --url https://github.com/{your-repo} --token ABCABCABCABCABCABCABCABCABCAB # accept default name, labels and work folder ./run.(sh/cmd)Install the Actions Runner on macOS (x64 or arm64)
mainTo install the runner on macOS, create a directory, download the appropriate
.tar.gzpackage, and extract it usingtar. Replace<RUNNER_VERSION>with your target version.# Create a folder mkdir actions-runner && cd actions-runner # Download the latest runner package curl -O -L https://github.com/actions/runner/releases/download/v<RUNNER_VERSION>/actions-runner-osx-x64-<RUNNER_VERSION>.tar.gz # Extract the installer tar xzf ./actions-runner-osx-x64-<RUNNER_VERSION>.tar.gzDownload GitHub Actions Runner for Windows, macOS, or Linux
mainCreate a Composite Action
mainA composite action allows you to bundle multiple run steps into a single action. To define one, create an
action.ymlfile and setruns.usingto"composite". You then define astepslist containing individualruncommands.Supported top-level attributes:
namedescriptioninputsrunsoutputs
Supported run step attributes:
nameidrunenvshell(Required)working-directory(Optional)
runs: using: "composite" steps: - run: pip install -r requirements.txt shell: bash - run: npm install shell: bashRegister and unregister problem matchers using workflow commands
mainYou can register or remove problem matchers during a GitHub Actions job using special workflow commands. This allows for ad hoc or conditional registration of matchers for specific tools.
Register a matcher: Use the
::add-matcher::command followed by the path to your problem matcher configuration JSON file.Unregister a matcher: Use the
::remove-matcher::command followed by theownername of the matcher you wish to remove.Note: If you register a matcher with an
ownername that is already in use, it will overwrite (clobber) the existing instance.::add-matcher::path-to-problem-matcher-config.json ::remove-matcher::ownerRequired Development Dependencies
mainTo develop and build the runner, ensure you have the following installed:
- Git: Git for Windows or Linux (required for
dev.shscript). - cURL: Required for external
shscripts. - Visual Studio:
- Windows: Visual Studio 2017 or newer.
- Windows ARM: Visual Studio 2022 17.3 Preview or later.
- Git: Git for Windows or Linux (required for
Install the Actions Runner on Linux (x64, arm64, or arm)
mainTo install the runner on Linux, create a directory, download the appropriate
.tar.gzpackage, and extract it usingtar. Replace<RUNNER_VERSION>with your target version.# Create a folder mkdir actions-runner && cd actions-runner # Download the latest runner package curl -O -L https://github.com/actions/runner/releases/download/v<RUNNER_VERSION>/actions-runner-linux-x64-<RUNNER_VERSION>.tar.gz # Extract the installer tar xzf ./actions-runner-linux-x64-<RUNNER_VERSION>.tar.gzDebug the Runner Listener
mainThe
Runner.Listenerprocess receives jobs queued on your repository (provided they match the runner's labels, e.g.,runs-on: self-hosted). You can launch this process using theRun [build]orRunconfigurations found in.vscode/launch.json.Note that when the listener receives a job, it starts a separate
Runner.Workerprocess. Because this is a different process, you cannot debug the worker using the same debugger session used for the listener; you must start a parallel debugging session.{ "name": "Run [build]", "type": "coreclr", "request": "launch", "preLaunchTask": "build runner layout", // use the config called "Run" to launch without rebuild "program": "${workspaceFolder}/_layout/bin/Runner.Listener", "args": [ "run" // run without args to print usage ], "cwd": "${workspaceFolder}/src", "console": "integratedTerminal", "requireExactSource": false, }