Skip to content

Commit

Permalink
Refactor version extraction in PR title update workflow for improved …
Browse files Browse the repository at this point in the history
…accuracy

Co-authored-by: Nicola Soranzo <[email protected]>
  • Loading branch information
arash77 and nsoranzo committed Nov 26, 2024
1 parent f3e65fa commit afdfa78
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/pr-title-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ jobs:
PR_TITLE: "${{ github.event.pull_request.title }}"
REPO: "${{ github.repository }}"
run: |
VERSION=$(echo $TARGET_BRANCH | grep -oP 'release_\K.*' || true)
VERSION=$(echo $TARGET_BRANCH | grep -oP '^release_\K\d+.\d+$' || true)
NEW_TITLE=$(echo "$PR_TITLE" | sed -E "s/\[[0-9]+\.[0-9]+\] //")
if [[ -n "$VERSION" ]]; then
NEW_TITLE="[$VERSION] ${PR_TITLE#*\] }"
else
NEW_TITLE="${PR_TITLE#*\] }"
NEW_TITLE="[$VERSION] $NEW_TITLE"
fi
if [[ "$NEW_TITLE" != "$PR_TITLE" ]]; then
gh pr edit $PR_NUMBER --repo "$REPO" --title "$NEW_TITLE"
Expand Down

0 comments on commit afdfa78

Please sign in to comment.