Using GerritHub with GitHub Actions

402 views Asked by At

I would like to add a project to gerrithub.io, where the continuous integration parts are done by GitHub Actions. I am considering the following steps given a new change to Gerrit:

  1. Replicate the change branch to GitHub.
  2. Add appropriate GitHub CI Actions to run on the change branch.
  3. Notify gerrithub.io about the CI result.

I am thinking of using Gerrit's REST API to do the notification in 3. However, I do not have a solution to the replication in 1. Any ideas?

2

There are 2 answers

0
lucamilanesio On

GerritHub allows to import GitHub PRs into Gerrit Changes, however, it looks like you would like to do the opposite and have the changes starting in Gerrit and import them as GitHub PRs.

Unfortunately, there isn't a solution available out-of-the-box right now. It shouldn't be very difficult to implement by using the GitHub API, however, I do see a problem having chained Changes represented in GitHub, because PRs cannot be chained.

HTH.

Luca.

0
Adam Spiers On

It seems that since the original answer in 2020 from @lucamilanesio, a solution to this was built by the Cue project, and presented by Paul Jolly at the Gerrit Virtual User Summit in 2021 (slides are here).

However, there seems to be a lack of pointers to how to set this up for our own repos. After some detective work I found https://github.com/cue-lang/cue/tree/master/.github/workflows and https://github.com/cue-lang/cue/blob/master/CONTRIBUTING.md#continuous-integration-ci-checks, but the latter doesn't seem to document how it works. A very nice high-level explanation is given at 7:05 in the talk, but it would be great if there were some basic instructions on how to set it up from scratch in a new repo.