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

[ISSUE-18] Customize cherry pick branch name #26

Merged
merged 1 commit into from
Dec 3, 2022
Merged

[ISSUE-18] Customize cherry pick branch name #26

merged 1 commit into from
Dec 3, 2022

Conversation

lampajr
Copy link
Contributor

@lampajr lampajr commented Dec 1, 2022

Fix #18

So that users can have control over the new cherry-pick branch name, like re-using the original branch name concatenaed with the target one:

    steps:
      - name: Calculate release branch
        run: |
          label=${{ matrix.name }}
          echo "RELEASE_BRANCH=release/v1" >> $GITHUB_ENV
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Perform cherry-pick
        uses: lampajr/github-cherry-pick-action@issue-18_cp_branch_name
        with:
          branch: "${{ env.RELEASE_BRANCH }}"
          title: "[${{ env.RELEASE_BRANCH }}] ${{ github.event.pull_request.title }}"
          body: "cherry-pick: ${{ github.event.pull_request.html_url }}"
          inherit_labels: false
          reviewers: |
            ${{ github.event.pull_request.user.login }}
          cherry-pick-branch: "${{ github.event.pull_request.head.ref }}_${{ env.RELEASE_BRANCH }}"

In this way users can cherry-pick the same change on more than one release branch or simply using their branching convention.

Note: In addition I also added some simple mocked tests that I used to validate the fix itself, I would include them too but if you don't agree I can remove them as well.

@lampajr
Copy link
Contributor Author

lampajr commented Dec 1, 2022

@lampajr
Copy link
Contributor Author

lampajr commented Dec 1, 2022

Hi @carloscastrojumo whenever you get time could you please code review this?

@carloscastrojumo
Copy link
Owner

Hi @lampajr . Thank you for your contribution, specially for the new suite of tests.

I'm ok with override the cherry-pick branch name, I'm just curious, and this is more related to the actual #18, in what scenarios is this an issue? Release branch + git commit SHA should always be unique or what am I missing?

@carloscastrojumo carloscastrojumo added the enhancement New feature or request label Dec 2, 2022
@lampajr
Copy link
Contributor Author

lampajr commented Dec 3, 2022

Hi @carloscastrojumo , you are right that's not an issue as I completely missed the inputs.branch in the prBranch creation, my bad sorry.

On the other hand, just to give you more context on why I need this change: we are actually using build-chain to perform cross-repositories projects builds - this tool relies on the branch name in order to cross check multiple PRs on different repos, therefore we must ensure that multiple PRs (on different repos, that's the crucial point) share the same branch name (which cannot be ensured if using commit sha as part of the branch name itself).

If you want I can create a new issue with this motivation and link it to this PR, wdyt?

@carloscastrojumo carloscastrojumo added enhancement New feature or request and removed enhancement New feature or request labels Dec 3, 2022
@carloscastrojumo
Copy link
Owner

It's fine. I will question the issue owner to see how can I help.

Thanks again for contributing.

@carloscastrojumo carloscastrojumo merged commit 5a41eda into carloscastrojumo:main Dec 3, 2022
@lampajr
Copy link
Contributor Author

lampajr commented Dec 4, 2022

Thank you very much @carloscastrojumo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

customized the cherry pick branch name
2 participants