Skip to content
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

Merged
merged 8 commits into from
Oct 14, 2024

Conversation

arash77
Copy link
Collaborator

@arash77 arash77 commented Sep 17, 2024

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)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@arash77 arash77 marked this pull request as ready for review September 26, 2024 12:46
@github-actions github-actions bot added this to the 24.2 milestone Sep 26, 2024
@jdavcs
Copy link
Member

jdavcs commented Oct 10, 2024

This is going to be very helpful, thanks!

Co-authored-by: Nicola Soranzo <[email protected]>
.github/workflows/pr-title-update.yml Outdated Show resolved Hide resolved
.github/workflows/pr-title-update.yml Outdated Show resolved Hide resolved
@nsoranzo
Copy link
Member

Thanks @arash77 !

@nsoranzo nsoranzo merged commit 3b4cfed into galaxyproject:dev Oct 14, 2024
39 of 42 checks passed
Copy link

This PR was merged without a "kind/" label, please correct.

@arash77 arash77 deleted the Update-PR-Title-Workflow branch October 14, 2024 08:53
Comment on lines +19 to +27
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

Potential injection from the ${{ github.event.pull_request.title }}, which may be controlled by an external user.
Copy link
Collaborator Author

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?

Copy link
Member

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

@nsoranzo
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants