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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

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.

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
Copy link
Member

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 }}
Copy link
Member

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

Copy link
Collaborator Author

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.

Copy link
Member

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]
Copy link
Member

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.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants