Skip to content

Commit

Permalink
feat(devx): allow automated backporting of PRs
Browse files Browse the repository at this point in the history
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
  • Loading branch information
hiddeco committed May 2, 2024
1 parent e90b388 commit bb6a8e3
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/backport.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Backport

on:
pull_request_target:
types: [closed, labeled]

permissions:
contents: read

jobs:
pull-request:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
if: github.repository_owner == 'akuity' && github.event.pull_request.merged && (github.event_name != 'labeled' || startsWith('backport/', github.event.label.name))
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create backport PRs
uses: korthout/backport-action@v2
# xref: https://github.com/korthout/backport-action#inputs
with:
# Use token to allow workflows to be triggered for the created PR
github_token: ${{ secrets.GITHUB_TOKEN }}
# Match labels with pattern `backport/<target-branch>`
label_pattern: '^backport\/([^ ]+)$'
# A bit shorter pull-request title than the default
pull_title: '[${target_branch}] ${pull_title}'
# Simpler PR description than default
pull_description: |-
Automated backport to `${target_branch}`, triggered by a label in #${pull_number}.
# Copy any labels (excluding those starting with "backport/") to the backport PR
copy_labels_pattern: '^(?!backport\/).*'
# Copy associated people to the backport PR
copy_assignees: true
copy_requested_reviewers: true
# Skip any merge commits in the source PR
merge_commits: 'skip'
# Automatically detect "squash and merge" instead of copying all
# commits from the source PR to the backport PR
experimental: >
{
"detect_merge_method": true
}

0 comments on commit bb6a8e3

Please sign in to comment.