Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

load-runner-info

Load the information for the runners that are available for the organization or the repository, including status checks. Can be used to verify the amount of runners for a label is as expected.

OpenSSF Scorecard

Security

All releases include a Software Bill of Materials (SBOM) in SPDX format (sbom.spdx.json) that provides detailed information about the dependencies used in this action. The SBOM is generated from GitHub's dependency graph and included as a release asset.

Example

Basic usage:

 - uses: devops-actions/load-runner-info@7f8c07227aa6176e94e4eeb912016bb0a9d33796 #v1.0.10id: load-runner-info-orgwith: accessToken: ${{ secrets.access_token }}organization: ${{ env.organization }}

Read the complete example for using the outputs as well.

Inputs

NameTypeDescription
organizationstringThe slug of the organization to load the runners from
repostringThe slug of the repo to load the runners from, organization required as well
accessTokenstringThe access token to use to connect to the GitHub API

Access token information

To run this action at the organization level, the access token must have scope admin:org (PAT) or org:Self-hosted runners (GitHub App). To run this action at the repository level, the access token must have scope owner:repo

Outputs

NameTypeDescription
runnersstringA JSON string with the runner information available
groupedstringA JSON string with the number of runner grouped by their labels, also indicating their status

When there are so many runners the JSON gets to large to use, use the filebased outputs instead:

NameTypeDescription
runners-file-locationstringThe path to the file with the runner information available
grouped-file-locationstringThe path to the file with the number of runners grouped by their labels, also indicating their status

Runners output example:

{
"total_count": 1,
"runners": [
{
"id": 2,
"name": "my-runner",
"os": "windows",
"status": "online",
"busy": false,
"labels": [
{
"id": 1,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 2,
"name": "Windows",
"type": "read-only"
},
{
"id": 3,
"name": "X64",
"type": "read-only"
}
]
}
]
}

Grouped output example:

[
{ "name": "self-hosted", "counter": 1, "status": 1 },
{ "name": "Windows", "counter": 1, "status": 1 },
{ "name": "X64", "counter": 1, "status": 1 }
]
Note: status indicates the number of the runners that is online for that label.

Full usage example

Below is an example how I use this action to load the information on the available runners as well as test if there are enough runners online (see step Test runner info).

jobs:
test-from-organization:
runs-on: ubuntu-lateststeps:
- name: Get access tokenid: get_workflow_tokenuses: peter-murray/workflow-application-token-action@dc0413987a085fa17d19df9e47d4677cf81ffef3 #3.3.0with:
application_id: ${{ secrets.APPLICATION_ID }}application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
- uses: devops-actions/load-runner-info@7f8c07227aa6176e94e4eeb912016bb0a9d33796 #v1.0.10id: load-runner-info-orgwith: accessToken: ${{ steps.get_workflow_token.outputs.token }}organization: ${{ env.organization }}
- name: Upload result file as artefact for inspectionuses: actions/upload-artifact@v4with: name: runners-organization-${{ env.organization }}path: - ${{ steps.load-runner-info-org.outputs.runners-file-location }}
- ${{ steps.load-runner-info-org.outputs.grouped-file-location }}
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1name: Test runner infowith: script: | const info = JSON.parse(`${{ steps.load-runner-info-org.outputs.runners-file-location }}`) if (info.length == 0) { core.error('No runners found')  return } console.log(`Found [${info.runners.length}] runner(s)`) for (let num = 0; num < info.runners.length; num++) { const runner = info.runners[num] console.log(`- name: [${runner.name}]`) } console.log(``) const grouped = JSON.parse(`${{ steps.load-runner-info-org.outputs.grouped-file-location }}`) console.log(`Found ${grouped.length} runner label(s)`) for (let num = 0; num < grouped.length; num++) { const group = grouped[num] console.log(`- label: [${group.name}], runner with this label: [${group.counter}] with [${group.status}] online runners`) } // example of a test you can do on the amount of runners online with this label const selfHosted = grouped.find(group => group.name === 'self-hosted') if (selfHosted.status > 10) { core.error(`Too many runners with label "self-hosted" found`) return } // example of a test you can do on the amount of runners online with this label if (selfHosted.status < selfHosted.counter) { core.error(`There are [${selfHosted.counter - selfHosted.status}] runners offline`) return }

About

Load the information for the runners that are available

Resources

Contributing

Security policy

Stars

19 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages