Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Github Runners Setup Skill

BSecurity

Set up a Linux machine as GitHub Actions self-hosted org runners (multi-runner folders, systemd services) with the local-if-idle / else-ubuntu-latest workflow. Gates gh scope refresh, sudo install, and PAT handling on explicit user action. Triggers: self-hosted runner, local CI runner, local-if-idle workflow.

6 stars
0 votes
0 copies
0 views
Added 9/20/2026
devopsgobashgitapidevops

Works with

terminalcliapi

Security Analysis

B88/100
criticalSends environment variables or credentials to an external URL

Scanned 9/20/2026

Install to Claude Code

$npx -y skills add darellchua2/opencode-config-template --skill github-runners-setup-skill --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Github Runners Setup Skill?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Github Runners Setup Skill
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/darellchua2-github-runners-setup-skill/badge)](https://www.skillsdirectory.com/skills/darellchua2-github-runners-setup-skill)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: github-runners-setup-skill
description: >-
  Set up a Linux machine as GitHub Actions self-hosted org runners
  (multi-runner folders, systemd services) with the local-if-idle /
  else-ubuntu-latest workflow. Gates gh scope refresh, sudo install, and
  PAT handling on explicit user action. Triggers: self-hosted runner,
  local CI runner, local-if-idle workflow.
license: Apache-2.0
compatibility: opencode
category: DevOps
---

## What I do

I turn a Linux box into a pool of GitHub Actions self-hosted runners for an
**organization**, one runner per subfolder of a chosen root (e.g.
`~/GITHUB_RUNNERS/r1..rN`), each as an auto-starting systemd service. I also
provide the workflow pattern that runs jobs on these runners **only when one
is online and idle**, falling back to `ubuntu-latest` otherwise.

Validated runbook (nus-cee org, Ubuntu 24.04, runners v2.337.0, 4 folders).

## When to use me

- "Set up this machine as GitHub Actions runners" / "add local runners to my org"
- "Use my machine for CI when it's free, GitHub's otherwise"
- Adding more runner folders to an existing pool

## Preconditions

- Linux x64, systemd, `gh` CLI installed and authenticated
- User is a member of the target org with rights to register runners
- Private repos (or public repos with fork-PR approvals enforced — self-hosted
  runners execute arbitrary workflow code from the repo)

## Procedure

Defaults below: org `ORG`, runner root `~/GITHUB_RUNNERS`, folders `r1..rN`,
host label prefix `<hostname>`. Ask the user for org + count + names once,
up front, with the question tool — then do not re-ask.

### 1. Scope check (GATED)

The registration API needs the `admin:org` scope. Check first:

```bash
gh auth status | grep -q "'admin:org'" || echo NEEDS_REFRESH
```

If refresh is needed, spawn it in a PTY, show the user the one-time code, and
**wait for their confirmation before continuing**:

```bash
gh auth refresh -h github.com -s admin:org
```

### 2. Install runner bits (automated)

Download once, extract into the first folder, copy to the rest:

```bash
VER=$(gh api /repos/actions/runner/releases/latest --jq .tag_name | tr -d v)
curl -sL -o /tmp/actions-runner-linux-x64-$VER.tar.gz \
  https://github.com/actions/runner/releases/download/v$VER/actions-runner-linux-x64-$VER.tar.gz
curl -sL -o /tmp/actions-runner-linux-x64-$VER.tar.gz.sha256 \
  https://github.com/actions/runner/releases/download/v$VER/actions-runner-linux-x64-$VER.tar.gz.sha256
( cd /tmp && sha256sum -c "actions-runner-linux-x64-$VER.tar.gz.sha256" )
mkdir -p ~/GITHUB_RUNNERS/r1
tar xzf /tmp/actions-runner-linux-x64-$VER.tar.gz -C ~/GITHUB_RUNNERS/r1
cd ~/GITHUB_RUNNERS
for d in r2 r3 r4; do cp -a r1 $d; done
```

Skip `installdependencies.sh` if a runner already works on this machine
(deps are system-wide); otherwise it needs sudo.

### 3. Register each runner (automated)

One registration token covers all folders (valid ~1h):

```bash
TOKEN=$(gh api orgs/ORG/actions/runners/registration-token --jq .token)
cd ~/GITHUB_RUNNERS
for d in r1 r2 r3 r4; do
  (cd $d && ./config.sh --url https://github.com/ORG --token "$TOKEN" \
     --name "$(hostname)-$d" --labels local --unattended)
done
```

Labels per runner: `self-hosted,Linux,X64,local` (defaults + `local`, the
pool label the workflow selects on). A transient 404 on the token mint can
be retried immediately.

### 4. Install services (GATED — user's terminal, never ours)

`svc.sh` needs sudo. **Never ask for the sudo password** — hand the user this
one line and wait for their "done":

```bash
for d in r1 r2 r3 r4; do (cd ~/GITHUB_RUNNERS/$d && sudo ./svc.sh install && sudo ./svc.sh start); done
```

Creates system services `actions.runner.<org>.<host>-rN.service`,
enabled at boot, running as the current user.

### 5. Verify (automated)

```bash
systemctl list-units 'actions.runner.*' --no-legend --plain
gh api /orgs/ORG/actions/runners --paginate \
  --jq '.runners[] | .name + " " + .status + " busy=" + (.busy|tostring)'
```

Expect every new runner `online busy=false` within ~30s and labels including
`local`. Registration is done at this point.

### 6. Local-if-idle workflow (GATED once for the PAT)

The runners list API needs a classic PAT with `admin:org`. The user must
create it (browser: Settings → Developer settings → Tokens classic) — do not
handle the token value in chat. Have the user run, in their own terminal:

```bash
read -rs PAT && gh secret set ORG_RUNNER_PAT --org ORG --visibility selected --repos REPO1,REPO2 <<< "$PAT" && unset PAT
```

Default to `--visibility selected` naming only the repos that opt into the
pool — the secret is an `admin:org` PAT, and `--visibility all` hands it to
every workflow in every repo of the org.

Then repos opt in by pairing a dispatcher job with the real job:

```yaml
jobs:
  pick-runner:
    runs-on: ubuntu-latest
    outputs:
      labels: ${{ steps.pick.outputs.labels }}
    steps:
      - id: pick
        env:
          GH_TOKEN: ${{ secrets.ORG_RUNNER_PAT }}
        run: |
          idle=$(gh api orgs/ORG/actions/runners --paginate \
            --jq '.runners[] | select(.labels[].name=="local") | select(.status=="online" and .busy==false) | .name' \
            | wc -l)
          if [ "$idle" -gt 0 ]; then
            echo 'labels=["self-hosted","local"]' >> "$GITHUB_OUTPUT"
          else
            echo 'labels=["ubuntu-latest"]' >> "$GITHUB_OUTPUT"
          fi
  build:
    needs: pick-runner
    runs-on: ${{ fromJSON(needs.pick-runner.outputs.labels) }}
    steps: [ ... real job ... ]
```

## Gate summary

| Gate | User action | Why |
|------|-------------|-----|
| 1 | Enter device code in browser | grants `admin:org` to gh |
| 4 | Run sudo one-liner in own terminal | agent must never take passwords |
| 6 | Create PAT + run `gh secret set` line | PAT value must not transit chat |

Every gate: state the exact command, what it does, then stop and wait for
explicit confirmation. Do not proceed on silence.

## Caveats

- **Race:** two runs can pick the same idle runner; the loser queues locally
  instead of falling back. Rare with 4+ runners; if it bites, add
  `timeout-minutes` + a `ubuntu-latest` retry job (`if: failure()`).
- **GitHub-first fallback is not possible** — hosted runners are never
  "unavailable", jobs just queue. Local-if-idle is the only deterministic
  direction.
- Dispatcher adds ~10–20s per run.
- `ORG_RUNNER_PAT` must be an **org** secret (`--org`), or repos won't see it.
  Keep `--visibility selected` — the PAT holds `admin:org`, so `all` exposes
  near-full org admin API to every workflow in every repo.

## Teardown

Per runner: `sudo ./svc.sh uninstall` (or stop+uninstall), then
`./config.sh remove --token "$(gh api orgs/ORG/actions/runners/registration-token --jq .token)"`,
then delete the folder.

Attribution

darellchua2darellchua2
View sourceMore from darellchua2 →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Terraform Module Library

Build reusable Terraform modules for AWS, Azure, and GCP infrastructure following infrastructure-as-code best practices. Use when creating infrastructure modules, standardizing cloud provisioning, or implementing reusable IaC components.

393431 votes

sematext-otel

Wire a service's OpenTelemetry output to Sematext Cloud. Walks through region, App-type, instrumentation flow (managed OTLP endpoint vs Sematext Agent), and signal selection (traces/metrics/logs), then produces the exact env-var block and points at a runnable reference example in this repo. Invoke when instrumenting a new app for Sematext.

01 votes

Deployment Patterns

Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications. Use when setting up deployment infrastructure or planning releases.

2459130 votes

Babysit

Watch a pull request or review cycle until it is ready to merge. Use when asked to babysit, monitor, or keep checking PR comments, reviews, and CI until all actionable issues are resolved.

929660 votes

V7 Roster

Interact with the Paperclip control plane API for task coordination and governance. Use when checking assignments, updating issue status, posting comments, delegating work, managing routines, or calling Paperclip API endpoints.

805540 votes
View all in devops →