Skip to content

Commit

Permalink
Merge pull request #19019 from arash77/backport-pr-title-update-workflow
Browse files Browse the repository at this point in the history
[24.0] Backporting PR title update workflow
  • Loading branch information
nsoranzo authored Oct 17, 2024
2 parents 638d13f + 677c90b commit 19811a6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/pr-title-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Update PR title

on:
pull_request_target:
types: [opened, edited]
branches:
- "release_**"

jobs:
update-title:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Update PR title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
TARGET_BRANCH: "${{ github.base_ref }}"
PR_TITLE: "${{ github.event.pull_request.title }}"
run: |
VERSION=$(echo $TARGET_BRANCH | grep -oP '\d+\.\d+')
if [[ -n "$VERSION" && ! "$PR_TITLE" =~ ^\[$VERSION\] ]]; then
NEW_TITLE="[$VERSION] $PR_TITLE"
gh pr edit $PR_NUMBER --title "$NEW_TITLE"
fi

0 comments on commit 19811a6

Please sign in to comment.