google / google/copybara

Merge destination PR using CHANGE_REQUEST_FROM_SOT

Open
#292 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

I have been testing Copybara and it's been working well for the following workflows:

- importing PR from destination -> source PR using `CHANGE_REQUEST`
- copying code from source main -> destination main using `ITERATIVE` mode and doing a fake merge on the destination PR if the source PR is merged

However, I also want to enable exporting PR from source -> destination workflow using `CHANGE_REQUEST_FROM_SOT` but I noticed this doesn't do a fake merge because the commits do not contain the label `COPYBARA_INTEGRATE_REVIEW`. It works if I manually amend the source PR commit to add this label and the link to the destination PR created. I also checked `after_migration` but can't seem to find a command to support this. I know that amending PR could trigger another workflow so it had to be done right before the source PR is merged. This doesn't seem like a common usage as I have not seen an example Cobybara config on this, is there a way to do this within Copybara?

```
core.workflow(
name = "push_pr",
origin = git.github_pr_origin(
url = SOURCE_REPO,
branch = BRANCH,
),
origin_files = glob(SOURCE_INCLUDES, exclude = SOURCE_EXCLUDES),
destination = git.github_pr_destination(
url = DESTINATION_REPO,
destination_ref = BRANCH,
integrates = [],
update_description = True,
),
destination_files = glob(DESTINATION_INCLUDES, exclude = DESTINATION_EXCLUDES),
authoring = AUTHOR,
mode = "CHANGE_REQUEST_FROM_SOT",
set_rev_id = False,
transformations = core.reverse(transforms),
)
```

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.