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
Automate the backports on PR merge to main #27450
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,34 @@ | ||||||
name: Automated Backporting via Dispatch | ||||||
|
||||||
on: | ||||||
workflow_dispatch: | ||||||
inputs: | ||||||
targetBranch: | ||||||
description: 'Release (22.0, 24.0, ...)' | ||||||
required: true | ||||||
type: string | ||||||
default: "24.0" | ||||||
pullRequest: | ||||||
description: 'Pull request (just the ID)' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be number, PRs have both a number (28087) and an ID (PR_kwDOAKnDVc5qMnnG)
Suggested change
|
||||||
required: true | ||||||
type: string | ||||||
dryRun: | ||||||
description: 'Dry run' | ||||||
required: false | ||||||
default: false | ||||||
type: boolean | ||||||
|
||||||
jobs: | ||||||
backporting: | ||||||
name: "Backporting" | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- name: Backporting | ||||||
uses: kiegroup/git-backporting@bce5dd4f9969d47da9cbb6ed06abbf87216afc98 # 4.5.1 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency, should we not be using the existing backport script here directly? If we're going to use an action going forward I'd argue it should be the only way to do a backport to avoid inconsistencies. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally I would just use the script and not an action, as I find it easy and quick to do that, but if others prefer a action then I don't see a big deal with having both. Good point about using the same approach both places thouyy |
||||||
with: | ||||||
target-branch: release/${{ inputs.targetBranch }} | ||||||
pull-request: https://github.com/${{ github.repository }}/pulls/${{ inputs.pullRequest }} | ||||||
auth: ${{ secrets.GITHUB_TOKEN }} | ||||||
dry-run: ${{ inputs.dryRun }} | ||||||
bp-branch-name: backport/${{ inputs.targetBranch }}/pr-${{ inputs.pullRequest }} | ||||||
no-squash: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Backport branch reaper | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
branches: | ||
- 'release/*.*' | ||
|
||
jobs: | ||
remove_backport_branch: | ||
if: startsWith(github.event.pull_request.head.ref, 'backport/') && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Delete PR head branches | ||
# language=bash | ||
run: | | ||
# safety switch that we only remove backport branches | ||
BP=$(echo ${{ github.event.pull_request.head.ref }} | sed 's|backport/||' ) | ||
jonkoops marked this conversation as resolved.
Show resolved
Hide resolved
|
||
gh api --method DELETE /repos/${{ github.event.pull_request.base.repo.full_name }}/git/refs/heads/backport/${BP} | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
branches-ignore: | ||
- main | ||
- dependabot/** | ||
- backport/** | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
|
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.
Should we have a default at all? This is likely to get quickly out of date. Also, can we provide a default if this value is already
required
?