Generates base64 encoded cloud-config user data for deploying a self-hosted GitHub Actions runner.
Minimal example using defaults with the required conditional inputs (repo
and owner
).
- name: Cloud-init user data for self-hosted runner
id: cloud-config
uses: rylabs-billy/action-runner-userdata@v1
with:
repo: postgres-cluster
owner: rylabs-billy
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
Minimal example with an organization
scope.
- name: Cloud-init user data for self-hosted runner
id: cloud-config
uses: rylabs-billy/action-runner-userdata@v1
with:
scope: organization
org: akamai-marketplace
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
Advanced example using all inputs to customize the runner ./config.sh
options, and passing the base64 encoded output to the next step.
on:
push:
branches:
- main
jobs:
self-hosted-runner:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Generate cloud-init user data
id: cloud-config
uses: rylabs-billy/action-runner-userdata@v1
with:
scope: repository
repo: postgres-cluster
owner: rylabs-billy
name: my_runner
runnergroup: my_group
labels: linode,cluster,dev,prod
work: _work
ephemeral: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Provision runner instance on Linode
uses: linode/action-linode-cli@v1
with:
token: ${{ secrets.LINODE_TOKEN }}
run: |
linode-cli linodes create \
--label linoderunner \
--root_pass aComplex@Password \
--region us-east \
--type g6-standard-2 \
--metadata.user_data "$USER_DATA"
env:
USER_DATA: ${{ toJson(steps.cloud-init.outputs.user-data) }}
This GitHub Action takes the following inputs:
The scope of the runner. Can be for a single repository or for an organization. A repository
scope (default) requires inputs for owner
and repo
.
Example: https://github.com/{owner}/{repo}
scope: repository
owner: {owner}
repo: {repo}
An organization
scope requires the org
input.
Example: https://github.com/{org}
scope: organization
org: {org}
Name of the runner. If provided then --replace
option is added to replace any existing runner with the same name in order to avoid naming conflicts. Otherwise the action defaults to generating a unique name by appending a timestamp to the repo or organization names.
(default yyyy-mm-dd-hhmmss-<repo/org>
)
Name of runner group to assign the runner in an organization.
(defaults to the default runner group)
Custom lables to apply in addition to the defaults.
(default self-hosted
,Linux
,X64
)
Relative work directory for the runner
(default _work
)
Configure the runner to take only one job, and then un-configure after the job finishes. This is recommend for public runners on public repositories to avoid security risks.
(default true
)
Base64 encoded cloud-init user data. Provide this output as the user-data parameter for a cloud provider's metadata service.
You want to improve action-runner-userdata! ๐
Please open a GitHub issue to report bugs or suggest features, or follow the fork and pull model for open source contributions.
GitHub runners will display warnings for inputs not specified in action.yml
.
This action takes three inputs that are conditionally required depending on the value of scope. Those inputs are repo
, owner
, and org
. Since they are conditionally dependent on the value of another input, statically defining them (each with its own description
, default
and required
fields) would just add unnecessary bloat. For this reason they are intentionally excluded from action.yaml
, which results in warnings such as the following:
Warning: Unexpected input(s) 'repo', 'owner', valid inputs are ['entryPoint', 'args', 'scope', 'name', 'runnergroup', 'labels', 'work', 'ephemeral']
These types of warnings can be ignored, as you will see them under normal usage. This action will error (not warn) if input requirements are not met. If it succeeds then everything should have worked properly.
For more information see: