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.5

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

awesome-runners 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 }}
          image_project: ubuntu-os-cloud
          image_family: ubuntu-2004-lts

  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

See inputs and descriptions here.

The GCE runner image should have at least:

  • gcloud
  • git
  • at
  • (optionally) GitHub Actions Runner (see actions_preinstalled parameter)

Example Workflows

Self-hosted runner security with public repositories

From GitHub's documentation:

We recommend that you only use self-hosted runners with private repositories. This is because forks of your repository can potentially run dangerous code on your self-hosted runner machine by creating a pull request that executes the code in a workflow.

EC2/AWS action

If you need EC2/AWS self-hosted runner, check out machulav/ec2-github-runner.