terraform-provider-github
terraform-provider-github copied to clipboard
Actions: Self-hosted runner
Thanks to https://github.com/github/roadmap/issues/73 we can create GithubAction groups with self-hosted runners
Expected Behavior
Define self-hosted runners in terraform, based on API ref [1]
Actual Behavior
lack of this possibility [1]
Steps to Reproduce
- create new Github Org
- go to
https://github.com/organizations/MY_ORG/settings/actions
and add a new groupby specifying repo scope
- Add a new runner with labels to this group [2]
- Execute Action with this group [3]
Proposed resources:
# add group [4]
github_actions_runner_group "dev" {
description = "DEV self-hosted runner group"
name = "dev-runners"
visibility = "all" #all, selected, or private
selected_repository_ids = ["repo1.id", "repo2.id"]
runners = [runner1.id, runner2.id] # optional
}
github_actions_runner "dev_win" {
description = "DEV self-hosted runners with Windows"
name = "dev-runners-win"
labels = ["dev", "win"]
}
resource "kubernetes_deployment" "dev_win" {
...
env {
GH_TOKEN = github_actions_runner.dev_win.token
}
}
References
[1] https://docs.github.com/en/rest/reference/actions [2] https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners [3] https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow [4] https://docs.github.com/en/rest/reference/actions#create-a-self-hosted-runner-group-for-an-organization