Skip to content

Commit

Permalink
Add labels to cherry pick scripts + writeup (#409)
Browse files Browse the repository at this point in the history
* Add labels when cherry picking with script

* fixup

* document tags

* add note

* prettier
  • Loading branch information
alamb committed Jun 5, 2021
1 parent 2ddc717 commit ddc8a36
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions dev/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ git clone git@github.com:apache/arrow-rs.git /tmp/arrow-rs
ARROW_GITHUB_API_TOKEN=$ARROW_GITHUB_API_TOKEN CHECKOUT_ROOT=/tmp/arrow-rs CHERRY_PICK_SHA=b2de5446cc1e45a0559fb39039d0545df1ac0d26 python3 dev/release/cherry-pick-pr.py
```

## Tags

There are two tags that help keep track of backporting:

1. [`cherry-picked`](https://github.com/apache/arrow-rs/labels/cherry-picked) for PRs that have been cherry-picked/backported to `active_release`
2. [`release-cherry-pick`](https://github.com/apache/arrow-rs/labels/release-cherry-pick) for the PRs that are the cherry pick

You can find candidates to cherry pick using this filter: https://github.com/apache/arrow-rs/pulls?page=2&q=is%3Apr+is%3Aclosed+-label%3Arelease-cherry-pick+-label%3Acherry-picked

## Rationale for creating PRs:

1. PRs are a natural place to run the CI tests to make sure there are no logical conflicts
Expand Down
9 changes: 8 additions & 1 deletion dev/release/cherry-pick-pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ def make_cherry_pick():
run_cmd(['git', 'push', '-u', 'origin', new_branch])



def make_cherry_pick_pr():
from github import Github
g = Github(token)
repo = g.get_repo(TARGET_REPO)

release_cherry_pick_label = repo.get_label('release-cherry-pick')
cherry_picked_label = repo.get_label('cherry-picked')

# Default titles
new_title = 'Cherry pick {} to active_release'.format(new_sha)
new_commit_message = 'Automatic cherry-pick of {}\n'.format(new_sha)
Expand All @@ -132,14 +136,17 @@ def make_cherry_pick_pr():
new_commit_message += '* Originally appeared in {}: {}\n'.format(
orig_pull.html_url, orig_pull.title)
new_title = 'Cherry pick {} to active_release'.format(orig_pull.title)
orig_pull.add_to_labels(cherry_picked_label)

pr = repo.create_pull(title=new_title,
body=new_commit_message,
base='refs/heads/active_release',
head='refs/heads/{}'.format(new_branch),
maintainer_can_modify=True
maintainer_can_modify=True,
)

pr.add_to_labels(release_cherry_pick_label)

print('Created PR {}'.format(pr.html_url))


Expand Down

0 comments on commit ddc8a36

Please sign in to comment.