mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 02:04:04 +08:00
use branches instead of if in the job, add permissions
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user