diff --git a/.github/workflows/pr-title-update.yml b/.github/workflows/pr-title-update.yml index 35b7ef4fa8ad..30d99a1760ad 100644 --- a/.github/workflows/pr-title-update.yml +++ b/.github/workflows/pr-title-update.yml @@ -3,10 +3,14 @@ name: Update PR Title If Target Branch Is A Version Branch on: pull_request_target: types: [opened] + branches: + - 'release_**' jobs: update-title: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - name: Update PR title env: @@ -15,11 +19,8 @@ jobs: PR_NUMBER=${{ github.event.pull_request.number }} TARGET_BRANCH=$(gh pr view $PR_NUMBER --json baseRefName -q .baseRefName) PR_TITLE=$(gh pr view $PR_NUMBER --json title -q .title) - - if [[ "$TARGET_BRANCH" != "dev" ]]; then - 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 + 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