-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add workflow to update PR title based on target branch version #18835
Conversation
Co-authored-by: Nicola Soranzo <[email protected]>
This is going to be very helpful, thanks! |
Co-authored-by: Nicola Soranzo <[email protected]>
Co-authored-by: Nicola Soranzo <[email protected]>
Thanks @arash77 ! |
This PR was merged without a "kind/" label, please correct. |
run: | | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
TARGET_BRANCH="${{ github.base_ref }}" | ||
PR_TITLE="${{ github.event.pull_request.title }}" | ||
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 |
Check failure
Code scanning / CodeQL
Expression injection in Actions Critical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we sanitize PR_TITLE to prevent injection here or is it unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sanitize it, but define it in env:
: #18987
@arash77 Should we backport (the latest version of) this workflow to, let's say, release_24.0 ? Otherwise it's not run on the PRs where it's actually useful. |
This will add a GitHub workflow to add the version number to the PR title if the target branch is a release branch.
How to test the changes?
(Select all options that apply)
License