Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
triangle

GitHub Action

Ephemeral GCE GitHub self-hosted runner

v0.2

Ephemeral GCE GitHub self-hosted runner

triangle

Ephemeral GCE GitHub self-hosted runner

Creates ephemeral GCE based GitHub Action self-hosted runner. It uses startup script to bootstrap the VM

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Ephemeral GCE GitHub self-hosted runner

uses: related-sciences/[email protected]

Learn more about this action in related-sciences/gce-github-runner

Choose a version

gce-github-runner

Pre-commit Test

Ephemeral GCE GitHub self-hosted runner.

Usage

jobs:
  create-runner:
    runs-on: ubuntu-latest
    outputs:
      label: ${{ steps.create-runner.outputs.label }}
    steps:
      - id: create-runner
        uses: related-sciences/[email protected]
        with:
          token: ${{ secrets.GH_SA_TOKEN }}
          project_id: ${{ secrets.GCP_PROJECT_ID }}
          service_account_key: ${{ secrets.GCP_SA_KEY }}

  test:
    needs: create-runner
    runs-on: ${{ needs.create-runner.outputs.label }}
    steps:
      - run: echo "This runs on the GCE VM"
      - uses: related-sciences/[email protected]
        with:
          command: stop
        if: always()
  • create-runner creates the GCE VM and registers the runner with unique label
  • test uses the runner, and destroys it as the last step

Inputs

Name Required Default Description
command True start start or stop of the runner.
token True GitHub auth token, needs repo/public_repo scope: https://docs.github.com/en/rest/reference/actions#self-hosted-runners.
project_id True ID of the Google Cloud Platform project. If provided, this will configure gcloud to use this project ID.
service_account_key True The service account key which will be used for authentication credentials. This key should be created and stored as a secret. Should be JSON key.
runner_ver True 2.278.0 Version of the GitHub Runner.
machine_zone True us-east1-c GCE zone.
machine_type True n1-standard-4 GCE machine type: https://cloud.google.com/compute/docs/machine-types
disk_size True 100g VM disk size.
runner_service_account False Service account of the VM, defaults to default compute service account. Should have the permission to delete VMs (self delete).
scopes True cloud-platform Scopes granted to the VM, should include rights to delete VMs.
shutdown_timeout True 30 Grace period for the stop command, in seconds.

Example Workflows