File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ name: Update PR title
3
3
on :
4
4
pull_request_target :
5
5
types : [opened, edited, reopened]
6
- branches :
7
- - " release_**"
8
6
9
7
jobs :
10
8
update-title :
19
17
PR_NUMBER : ${{ github.event.pull_request.number }}
20
18
TARGET_BRANCH : " ${{ github.base_ref }}"
21
19
PR_TITLE : " ${{ github.event.pull_request.title }}"
20
+ REPO : " ${{ github.repository }}"
22
21
run : |
23
- VERSION=$(echo $TARGET_BRANCH | grep -oP '\d+\.\d+')
24
- if [[ -n "$VERSION" && ! "$PR_TITLE" =~ ^\[$VERSION\] ]]; then
25
- NEW_TITLE="[$VERSION] $PR_TITLE"
26
- gh pr edit $PR_NUMBER --repo "${{ github.repository }}" --title "$NEW_TITLE"
22
+ VERSION=$(echo $TARGET_BRANCH | grep -oP '^release_\K\d+.\d+$' || true)
23
+ NEW_TITLE=$(echo "$PR_TITLE" | sed -E "s/\[[0-9]+\.[0-9]+\] //")
24
+ if [[ -n "$VERSION" ]]; then
25
+ NEW_TITLE="[$VERSION] $NEW_TITLE"
26
+ fi
27
+ if [[ "$NEW_TITLE" != "$PR_TITLE" ]]; then
28
+ gh pr edit $PR_NUMBER --repo "$REPO" --title "$NEW_TITLE"
27
29
fi
You can’t perform that action at this time.
0 commit comments