Skip to main content

Configuring Build Hub for GitHub Actions

To successfully use Build Hub for GitHub Actions, you need to:

  1. Create a machine pool on Bitrise.

    The machine pool requires authentication information. You can either:

  2. Configure your GitHub Actions workflow to use Bitrise infrastructure for your builds.

Creating GitHub personal access tokens for Build HubClick to copy link

note

This step is optional. Create a personal access token only if you're not using the Bitrise Build Hub GitHub App.

You can use a GitHub personal access token to authenticate Build Hub to GitHub Actions. You can use either a classic access token or a fine-grained access token, depending on your needs. Read more on how authentication works: Authentication for Build Hub.

To create the token on GitHub:

  1. Go through the process described here until you get to selecting a resource owner.

  2. Select a resource owner: it should be the organization.

    Authorization

    The organization might require authorization for the token: for example, you might be prompted to log in via SSO.

  3. Under Repository access, select All repositories.

  4. Under Permissions, select Organizations.

  5. Click Add permissions.

  6. Select Self-hosted runners.

  7. Set the access to Read and write.

    github-fine-grained-token-permissions.png

  8. Click Generate token.

  9. Copy your personal access token: you won't be able to see it again but you need it when creating a machine pool.

Creating a machine poolClick to copy link

Create a machine pool that allows running GitHub Action builds on Bitrise hardware. The process is slightly different based on whether you use a GitHub app or a GitHub personal access token for authentication.

  1. On the left navigation bar, select Build Hub.

    SCR-20260320-nseo.png

  2. Click +Machine pool.

  3. Open the Select account dropdown menu and click Connect account.

  4. Select GitHub (GitHub App) and click Continue to install.

    SCR-20260320-mmwy.png

  5. Select the resource owner.

  6. Select the repository scope.

    • All repositories: Applies to all current and future repositories owned by the resource owner. Also includes public repositories (read-only).
    • Only select repositories: Select at least one repository. Also includes public repositories (read-only).

    SCR-20260320-nqmt.png

  7. Add a runner group and optionally, a runner version.

    • The runner version needs to be exact, such as v2.328.0. If you don't specify a runner version, the latest version will be used.
    • Runner groups are used to collect sets of runners and create a security boundary around them.
  8. Check Use Bitrise for GitHub Actions caching if you want Bitrise infrastructure to handle GitHub Actions cache requests instead of GitHub's cache backend.

    This results in faster cache operations.

  9. Click Next.

  10. Set a unique name for the pool.

  11. Select the image in the Image dropdown menu and the amount of machines you need in the Nr. of machines field.

    You can check the images on the stack reports page.

    SCR-20260309-pxsf.png

  12. Select a machine type.

    For more information about Bitrise machines, check out Build machines.

  13. Set a rolling update percentage: this is the amount of machines to be rebooted simultaneously after reconfiguration.

  14. When done, click Next.

  15. Create labels: they allow your GitHub Actions configuration to target your Bitrise runner pool. You must have at least one label.

    Labels are a key-value pair but only the key is mandatory. By default, Bitrise suggests labels for the pool name, the image, and the machine type. You can change these at any time.

  16. Optionally, add a warmup script to customize your build environment. When done, click Create pool.

    Leave it empty if you don’t need a warmup script.

    Non-zero exit code

    Make sure that it returns a non-zero exit code in case of an error. The script will only fail if your script returns with a non-zero exit code.

Configuring your GitHub Actions workflowClick to copy link

After you successfully create a machine pool, you need to configure your GitHub Actions workflow to use the machine pool when running your builds.

Use the runs-on property in your workflow to specify the Bitrise machines. You can target runners based on the labels assigned to them.

  1. Open your GitHub repository and select Actions.

  2. On the left, click the name of the Workflow.

  3. Under the name of the Workflow, click deploy.yml.

  4. Add the runs-on property to the jobs you want to run on Build Hub. You must target the labels you create when creating or updating a machine pool.

    • You can use a single label. This will allow the use of all runners that have the specified label:

      jobs:
      build:
      runs-on: image:xcode-26
    • You can use an array of labels. A runner is only allowed if it has all the specified labels:

      jobs:
      build:
      runs-on: [bitrise_pool_name:bitrise-runner, image:xcode-26]

For more information on the runs-on property, check out the GitHub Actions documentation.

Enabling Linux machines to access toolingClick to copy link

Linux machines require a workaround to access the preinstalled tools on the Linux image when running a GitHub Actions workflow on Build Hub.

When a GitHub Actions workflow uses the container: property to run steps inside a Docker container, the runner changes the environment in ways that break the image's tool setup. This means that the build can't access asdf as the tool manager and therefore preinstalled tools are not accessible.

To solve the problem:

  1. Add an env property to your container configuration in the GitHub Actions workflow. Set three Environment Variables to tell asdf where its core scripts and plugins, installed versions, and shims are, and to override the image's BASH_ENV=/.bashrc.

    container:
    image: bitriseio/ubuntu-noble-24.04-bitrise-2025-android:latest
    env:
    ASDF_DIR: /root/.asdf
    ASDF_DATA_DIR: /root/.asdf
    BASH_ENV: /root/.asdf/asdf.sh
  2. Under the defaults property, set the default shell to bash.

    container:
    image: bitriseio/ubuntu-noble-24.04-bitrise-2025-android:latest
    env:
    ASDF_DIR: /root/.asdf
    ASDF_DATA_DIR: /root/.asdf
    BASH_ENV: /root/.asdf/asdf.sh
    defaults:
    run:
    shell: bash
  3. Under the steps property, add a step that copies the image's default tool versions to where asdf expects them.

    steps:
    - name: Setup environment
    run: |
    cp /root/.tool-versions "$HOME/.tool-versions"
  4. Tell Git to treat all working directories as safe. Without this, some commands might fail because of directory ownership mismatch.

    steps:
    - name: Setup environment
    run: |
    cp /root/.tool-versions "$HOME/.tool-versions"
    git config --global --add safe.directory '*'