-
Notifications
You must be signed in to change notification settings - Fork 992
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
base: dev
Are you sure you want to change the base?
Conversation
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 |
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.
I think it would be better if you use https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-including-branches to check that the target branch starts with release_
.
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
steps: | ||
- name: Update PR title | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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.
You can probably use https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#permissions instead of the token, see e.g. .github/workflows/maintenance_bot.yaml
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.
We have to set permissions but in maintenance_bot.yaml
it is using actions/github-script
that will automatically get it.
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.
actions/labeler
, also used in that workflow, needs the permissions: https://github.com/actions/labeler?tab=readme-ov-file#permissions
|
||
on: | ||
pull_request_target: | ||
types: [opened] |
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 sure this covers the case of someone changing the target branch of an already opened PR.
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