-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: find a way to reenable the cherry-picker process #3958
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Cherry pick | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: ["closed"] | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
cherry_pick_release_v1_1: | ||
runs-on: ubuntu-22.04 | ||
name: Cherry pick into release/v1.1 | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'cherrypick/release-v1.1') && github.event.pull_request.merged == true }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
|
||
- name: Cherry pick into release/v1.1 | ||
run: | | ||
TARGET_BRANCH="release/v1.1" | ||
CHERRY_PICK_BRANCH="cherry-pick-$(date +'%Y%m%d%H%M%S')" | ||
MERGE_COMMIT_SHA=$(git log -1 --pretty=format:%H) | ||
|
||
# Fetch and create new branch from target | ||
git fetch origin $TARGET_BRANCH | ||
git checkout -b $CHERRY_PICK_BRANCH origin/$TARGET_BRANCH | ||
|
||
# Cherry-pick the commit | ||
git cherry-pick $MERGE_COMMIT_SHA || git cherry-pick --abort | ||
|
||
# Push the new branch | ||
git push origin $CHERRY_PICK_BRANCH | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "Cherry pick ${MERGE_COMMIT_SHA} into ${TARGET_BRANCH}" | ||
branch: $CHERRY_PICK_BRANCH | ||
title: "[release/v1.1] Cherry pick ${MERGE_COMMIT_SHA}" | ||
body: "Cherry picking commit ${MERGE_COMMIT_SHA} onto ${TARGET_BRANCH}" | ||
base: $TARGET_BRANCH |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we create branch with read permission?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing that out. I should have update the permissions in the workflow to ensure that the action can create and push branches. The permissions should be set to
contents: write
andpull-requests: write
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Manoramsharma thanks for you work, but I think this's not a good issue for begginer(this one need a lot of collaborations with the Envoyproxy org admin).