As far as I can tell there are two ways of triggering a Google Cloud Build on a GitHub repo:
- All pull requests are automatically built
- Define a trigger than runs when a branch is changed
An unmerged GitHub pull request has 2 refs as shown here:
$ git ls-remote
From [email protected]:user/repo
1680161331c0a0ebcf59fb1ef2f4dbe27b857418 HEAD
9e1d427bfcd97d8ac2eda7661cc8a21da2355d19 refs/heads/if_deps
ee8328eb1e5fa38c9cc39c86d8b0896c9eaec73c refs/heads/mcmc-fixes
1680161331c0a0ebcf59fb1ef2f4dbe27b857418 refs/heads/master
94d3a40412aff060a2a820d164dfd52050cac192 refs/pull/1/head
9e1d427bfcd97d8ac2eda7661cc8a21da2355d19 refs/pull/2/head
ccb44a8c12ed9d79e76551e7876892c9e87de032 refs/pull/2/merge
ee8328eb1e5fa38c9cc39c86d8b0896c9eaec73c refs/pull/3/head
f9928f924698042939008e8526094662b7f44125 refs/pull/3/merge
- PR #1 has been merged and only has
refs/pull/1/head - PRs #2 and #3 have not been merged and
refs/pull/2/mergealso exist
Unfortunately the automatic pull request trigger only builds the refs/pull/*/head ref and not the refs/pull/*/merge ref. It is more important to build refs/pull/*/merge to prove that the pull request can be safely merged into master.
So I am trying to define a trigger to run on refs/pull/*/merge
As far as I can tell Google Cloud Build triggers only match GitHub refs of the form refs/heads/<regex> though:
Is it possible to trigger a build when a refs/pull/*/merge branch is changed?
