google / google/copybara

Suggestions for improving GitHub PR to Gerrit CR workflow?

Open
#249 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.8k
Forks
345
PR merge metrics
No merged PRs in 30d

Description

Thank you for this wonderful tool!

I have a GitHub PR to Gerrit CR workflow, and am wondering about general advice to improve on this.

Workflow is simple, looks something like the below.

Issues:

- Each time the PR is updated, this results in a new Change-ID and thus new Gerrit CR. Is there a way to have this update the existing CR rather than create a new one? Basically, to have the change-id be stable per PR number.
- For the `reviewers`, how do you use `GITHUB_PR_REVIEWER_APPROVER`? I guess - is there any documentation available on how to use labels, repeated labels, etc. that the API reference mentions?
- If user submits PR, copybara runs, and then user sets a reviewer—is there a way to also set the reviewer in Gerrit?
- Any other suggested improvements or typical things you'd do in this setup?

Thank you!

```
core.workflow(
name = "public_pr_to_private_cr",
origin = git.github_pr_origin(
url = publicUrl,
#use_merge = True,
#baseline_from_branch = True,
),
destination = git.gerrit_destination(
url = "https://plasmic.app/a/yangcopytest",
fetch = 'master',
reviewers = ['${GITHUB_PR_REVIEWER_APPROVER}']
),
origin_files = glob(["studio/**"]),
destination_files = glob(['**'], exclude = ["copy.bara.sky", "private"]),
authoring = authoring.pass_thru("Copybara "),
mode = 'CHANGE_REQUEST',
transformations = [
core.move("studio", ""),
metadata.replace_message(
"${GITHUB_PR_TITLE}\n\n" +
"${GITHUB_PR_BODY}\n\n" +
"Closes #${GITHUB_PR_NUMBER}\n" +
"https://github.com/yang/copytest/pull/${GITHUB_PR_NUMBER}",
),
],
)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.