{"id":43756250,"url":"https://github.com/unravelin/gcb2gh","last_synced_at":"2026-02-05T14:30:54.490Z","repository":{"id":45025012,"uuid":"352387003","full_name":"unravelin/gcb2gh","owner":"unravelin","description":"GitHub status updates from Google Cloud Build builds.","archived":false,"fork":false,"pushed_at":"2025-11-12T10:14:29.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-11-12T12:09:42.242Z","etag":null,"topics":["build","ci","continuous-integration","docker","gcb","github","github-actions","google-cloud","google-cloud-build","google-cloud-builder","google-cloud-platform","google-containers"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unravelin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-28T17:00:53.000Z","updated_at":"2025-11-12T10:14:32.000Z","dependencies_parsed_at":"2024-06-21T12:49:55.372Z","dependency_job_id":"3824716c-798b-4a15-a08a-b16d1922065c","html_url":"https://github.com/unravelin/gcb2gh","commit_stats":{"total_commits":21,"total_committers":3,"mean_commits":7.0,"dds":"0.19047619047619047","last_synced_commit":"5190261b80bdb8c8f4a63331f1180300333137c4"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/unravelin/gcb2gh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unravelin%2Fgcb2gh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unravelin%2Fgcb2gh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unravelin%2Fgcb2gh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unravelin%2Fgcb2gh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unravelin","download_url":"https://codeload.github.com/unravelin/gcb2gh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unravelin%2Fgcb2gh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29123675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T14:05:12.718Z","status":"ssl_error","status_checked_at":"2026-02-05T14:03:53.078Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build","ci","continuous-integration","docker","gcb","github","github-actions","google-cloud","google-cloud-build","google-cloud-builder","google-cloud-platform","google-containers"],"created_at":"2026-02-05T14:30:53.456Z","updated_at":"2026-02-05T14:30:54.485Z","avatar_url":"https://github.com/unravelin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gcb2gh\n\n![image](https://user-images.githubusercontent.com/408401/112832948-f0d1c580-908d-11eb-9e78-04433bdf3884.png)\n\nIf you're both a Google Cloud Build and GitHub user then you will either be:\n\n- resigned to the \"summary\" and multiple clicks of using Google Cloud Build's\n  GitHub app;\n- running a cloud function to watch for build results; and/or\n- manually making API calls to GitHub from within build steps to provide more\n  detail.\n\ngcb2gh solves this with a build step in your cloudbuild.yaml which sends status\nupdates to GitHub for each step that starts or stops in Google Cloud Build. The\nstatus links directly to the running or failed steps.\n\ngcb2gh runs in a detached Docker container - putting itself in the background -\nand connects to the [Docker API event\nstream](https://docs.docker.com/engine/api/v1.41/#operation/SystemEvents) which\nit translates into updates to [GitHub repo\nstatuses](https://docs.github.com/en/rest/reference/repos#create-a-commit-status).\n\nAt ravelin.com (github.com/unravelin) we use gcb2gh alongside the [GCB GitHub\napp](https://github.com/marketplace/google-cloud-build), which is able to report\nwhen a build fails to start (such as with an invalid build YAML) or when a build\ngets cancelled. gcb2gh runs inside the build so cannot tell you this.\n\n## Usage\n\n### 1. Build your own gcb2gh image\n\nLike with the [community\ncloud-builders](https://github.com/GoogleCloudPlatform/cloud-builders-community),\nyou must build and host your own gcb2gh container image on the Google Container\nRegistry. To do so, clone this repo and submit the directory as a build.\n\nThe following will create the image gcr.io/MY-PROJECT/gcb2gh for you to use in a\nbuild step:\n\n```\ngit clone https://github.com/unravelin/gcb2gh\ncd gcb2gh\ngcloud --project MY-PROJECT builds submit . --substitutions _GCR_HOST=gcr.io\n```\n\n### 2. Add the gcb2gh build step to your build manifest\n\nThe following example build step runs gcb2gh with the configuration envvars:\n\n- GITHUB_USER and GITHUB_REPO: Pointing to github.com/unravelin/gcb2gh.\n\n- GITHUB_TOKEN: Read from a github-token secret. The token should have a\n  `repo:status` scope.\n\n- BUILD_MANIFEST: Pointing to /workspace/cloudbuild.yaml so that we can read the\n  step IDs. Note that we have to explicitly mount /workspace for gcb2gh as it is\n  not a build step, so GCB won't mount it automatically.\n\n- BUILD_ID, PROJECT_ID, and COMMIT_SHA: all taken from [built-in\n  substitutions](https://cloud.google.com/build/docs/configuring-builds/substitute-variable-values)\n  of the same name.\n\nIf you built your gcb2gh image to a different project or gcr.io host, be sure\nthat the last line is pointing to the correct image.\n\nPlacing the gcb2gh step at the end ensures we don't cause other steps to wait\nwhile the gcb2gh Docker image is downloaded.\n\n```yaml\navailableSecrets:\n  secretManager:\n  - versionName: projects/$PROJECT_ID/secrets/github-token/versions/1\n    env: 'GITHUB_TOKEN'\n\nsteps:\n  ...\n\n  # At the end, to ensure we don't block other steps.\n  - id: gcb2gh\n    waitFor: [\"-\"]\n    name: \"gcr.io/cloud-builders/docker\"\n    secretEnv: [GITHUB_TOKEN]\n    args: [\n      \"run\", \"--name\", \"gcb2gh\", \"--detach\",\n      # Configure: the GitHub repo.\n      \"--env\", \"GITHUB_TOKEN\",\n      \"--env\", \"GITHUB_USER=unravelin\",\n      \"--env\", \"GITHUB_REPO=gcb2gh\",\n      # Configure: the build manifest.\n      \"--mount\", \"type=bind,source=/workspace,target=/workspace,bind-propagation=rprivate\",\n      \"--env\", \"BUILD_MANIFEST=/workspace/cloudbuild.yaml\",\n      # GCB specifics.\n      \"--env\", \"BUILD_ID=$BUILD_ID\",\n      \"--env\", \"PROJECT_ID=$PROJECT_ID\",\n      \"--env\", \"COMMIT_SHA=$COMMIT_SHA\",\n      \"--mount\", \"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,bind-propagation=rprivate\",\n      \"gcr.io/$PROJECT_ID/gcb2gh\",\n    ]\n\n  # Optional step to debug gcb2gh.\n  - id: gcb2gh_logs\n    name: \"gcr.io/cloud-builders/docker\"\n    args: [logs, gcb2gh]\n```\n\n### 3. Configure further as needed\n\nThe full set of support environment variables are:\n\n- PROJECT_ID: The GCB Project ($PROJECT_ID substitution).\n\n- BUILD_ID: The GCB Build ID ($BUILD_ID substitution).\n\n- COMMIT_SHA: The Git commit SHA of the code we're building ($COMMIT_SHA\n  substitution).\n\n- DOCKER_HOST: The docker daemon to connect to. Defaults to\n  unix:///var/run/docker.sock as used in GCB.\n\n- GITHUB_API: The GitHub API URL. Defaults to https://api.github.com.\n\n- GITHUB_TOKEN: The GitHub API authentication Token in the form \"user:pass\",\n  \":pass\" or just \"pass\".\n\n- GITHUB_USER: The user in https://github.com/user/repo.\n\n- GITHUB_REPO: The repo in https://github.com/user/repo.\n\n- STATUS_CONTEXT: The title given to the Commit Status at the bottom of PRs.\n  Defaults to \"gcb\".\n\n- BUILD_MANIFEST: The filepath of the GCB build manifest which we read to get\n  pretty step names. You will need to ensure the directory is mounted into the\n  background container. Steps will be \"step_1\" to \"step_n\" in the commit status\n  if a build manifest cannot be read.\n\n## Contributing\n\nPlease feel free to open issues and pull requests on this repository. If you\nwish to suggest a code change, please ensure the behaviour is tested in `go\ntest`. The tests are already set up with a toy Docker daemon you can mock events\nfrom; and a GitHub API that will record the updates sent.\n\nPlease ⭐ star this [cloud build feature\nrequest](https://issuetracker.google.com/issues/183851546) which would mean\ngcb2gh doesn't have to parse the build manifest itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funravelin%2Fgcb2gh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funravelin%2Fgcb2gh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funravelin%2Fgcb2gh/lists"}