google / copybara

Copybara: A tool for transforming and moving code between repositories.
Apache License 2.0
2.13k stars 258 forks source link

Merge destination PR using CHANGE_REQUEST_FROM_SOT #292

Open rainecp opened 3 months ago

rainecp commented 3 months ago

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

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),
)