Building repositories from GitHub

GitHub triggers enable you to automatically build on Git pushes and pull requests and view your build results on GitHub and Google Cloud console.

This page explains how to create GitHub triggers and build repositories from GitHub using the Cloud Build GitHub app. Learn more about Cloud Build triggers and Cloud Build repositories.

Before you begin

  • Enable the Cloud Build API.

    Enable the API

Building and viewing your changes

To build using GitHub triggers, you'll need to push and commit changes to your connected source repository or configure your build on pull requests. Once you have checked in your changes, Cloud Build will build your code.

To view your build changes on GitHub, go to the Checks tab in your repository.

Screenshot of the conversation tab

You'll see that Cloud Build has built your changes. You'll also see other build details such as the time it took to build your code and the build ID.

To view your build changes in Cloud Build, click on View more details on Google Cloud Build. The Build details page in Google Cloud console opens where you can see build information such as status, logs, and build steps.

Data sharing

The data sent to GitHub from Cloud Build helps you identify triggers by name and see build results on GitHub.

The following data is currently shared between Cloud Build and GitHub:

  • Cloud project ID
  • Trigger name
  • Build logs

If you created triggers prior to August 2020, data sharing may not be enabled for your project. You can enable data sharing for all GitHub triggers in your project by clicking Enable on the Cloud Build Data sharing tab.

If you have required status checks enabled for a GitHub repository, enabling data sharing may temporarily break status checks. You can adjust status check configurations to look for your trigger name by:

  • Disabling any Cloud Build-specific required checks on the GitHub repository
  • Ensuring that data sharing is enabled in Cloud Build
  • Executing a new build in Cloud Build that posts statuses to your repository
  • Re-enabling required status checks, selecting trigger name

What's next