Shape the future of software delivery and make your voice heard by taking the 2021 State of DevOps survey.

List build triggers

List build triggers with the client libraries. To learn more about triggers: https://cloud.google.com/build/docs/automating-builds/create-manage-triggers

Code sample

Node.js

async function listBuildTriggers(
  projectId = 'YOUR_PROJECT_ID' // Your Google Cloud Platform project ID
) {
  // Imports the Google Cloud client library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild');

  // Creates a client
  const cb = new CloudBuildClient();

  // What project should we list triggers for?
  const request = {
    projectId,
  };

  const [result] = await cb.listBuildTriggers(request);
  console.info(JSON.stringify(result, null, 2));
}

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser