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

feat: allow backporting to remote repository #405

Merged
merged 6 commits into from
May 3, 2024
Merged

Conversation

tasso94
Copy link
Contributor

@tasso94 tasso94 commented Dec 19, 2023

This pull request is still a work in progress, but I wanted to share my first iteration to get feedback early on:

  1. Whether it generally makes sense and if you want to merge it with your upstream.
  2. If the technical design of the feature makes sense.

User story

As a user, I maintain my master branch and the backport branches in two separate repositories to hide my backport branches from the public.

Open tasks

I think the following topics still need to be addressed (is there even more I might not know yet?):

  • Improve the naming of newly introduced config properties (I'm open to any ideas).
  • Write documentation.

@korthout korthout linked an issue Dec 21, 2023 that may be closed by this pull request
@korthout
Copy link
Owner

Thanks @tasso94 🙇 I'm currently enjoying some time off, so it may take me some more time until I review this. But at first glance, this looks amazing!

Copy link
Owner

@korthout korthout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this massive contribution @tasso94 🙇 This will be super useful!

I've had a closer look at the changes and have a few comments, suggestions, and questions. I've used an emoji review code to clarify my comments. Please have a look.

src/backport.ts Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
src/git.ts Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
@tasso94
Copy link
Contributor Author

tasso94 commented Jan 15, 2024

Hi @korthout,

Thanks for your review feedback, and I'm sorry for my late response.

Right now, I'm a bit busy but I'll try to have a look soon.

Stay tuned!

Best,
Tassilo

@tasso94
Copy link
Contributor Author

tasso94 commented Jan 25, 2024

Hi @korthout,

Thank you for providing your input. I applied your review hints. 🙂 👍
Could you please review my changes?

I know that I still need to document the new properties. If you don't have any further remarks regarding the naming or characteristics of the properties, I will add the documentation.

Is there anything else that is required from my side to make this PR merge-ready? Do you want me to contribute tests?

Best,
Tassilo

@korthout
Copy link
Owner

Thanks for the great work @tasso94. I want to give this the proper attention it deserves, but I've been too busy at work as well as in my personal life (with an international move coming up ahead) to review this. Please know that I haven't forgotten about this. I really appreciate this effort and see it as a big improvement to the action. A full review will follow.

@tasso94
Copy link
Contributor Author

tasso94 commented Feb 20, 2024

Hi @korthout,

Do you already have a plan for when you review my contribution? 🙂

Best,
Tassilo

Copy link
Owner

@korthout korthout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tasso94 for the improvements. Sorry for taking so long 🙇 I want to give this the attention it deserves, but it was hard to find the time. Now, I finally had a chance to give it a spin, and I'm happy to report that it works! It's really cool to see it in action! 🚀

Some notes:

  • ❌ There's a small mistake in one of the logs. It refers to origin, but actually pushed to target. This should be changed before merging. See below.
  • 💭 I've tried to think a bit more on our usage of the word remote to mean the other repository. GitHub uses upstream as the name for the original repository from the perspective of a forked repository. In that same analogy, what we're currently calling remote is actually the downstream repository. Changes from the original repository are backported to a downstream repository (often a fork). However, I worry that downstream is too unfamiliar to be used here. So, perhaps remote is still the best wording. I'd love your input on this.
  • 📝 since the default GITHUB_TOKEN does not have write access to the other repository, it's mandatory to use a PAT for the token input of the checkout action and the github_token input of the backport-action itself. We should document this alongside these inputs.

Example of log wrongly referring to origin

Push branch to origin
git push --set-upstream target backport-365-to-case5-backport-target

In addition to my ramblings on naming things and the small logging mistake, I only have a few minor suggestions. Please have a look 🙇

👍 I'll be happy to merge this with a bit of documentation

EDIT: Regarding tests, we can do without for now. It would be cool to expand https://github.com/korthout/backport-action-test with some test case for this eventually. But it's fine to only cover this manually for now.

src/backport.ts Outdated Show resolved Hide resolved
src/backport.ts Outdated Show resolved Hide resolved
src/backport.ts Outdated Show resolved Hide resolved
@tasso94
Copy link
Contributor Author

tasso94 commented Mar 6, 2024

Hi @korthout,

Thank you for the review and for bringing up the naming. 🙂 👍

I prefer downstream to remote since the latter is super generic, whereas the former is self-explanatory.

What do you think? Should we move forward with downstream? 🤔

@korthout
Copy link
Owner

Let's go for it!

@korthout
Copy link
Owner

@tasso94 is there anything I can do to help get this merged?

action.yml Outdated Show resolved Hide resolved
@tasso94
Copy link
Contributor Author

tasso94 commented Apr 11, 2024

Hi @korthout,

I was quite busy in the last couple of weeks.
I'll did some final touches and incorporated your latest feedback. I'll have a final look Tomorrow. Thanks for your patience! 🙂 👍

Best,
Tassilo

@tasso94 tasso94 requested a review from korthout April 12, 2024 11:22
@tasso94 tasso94 marked this pull request as ready for review April 12, 2024 11:23
@tasso94
Copy link
Contributor Author

tasso94 commented Apr 30, 2024

Hi @korthout,

Friendly reminder to review my latest changes 🙂 👍

Best,
Tassilo

If git fetch fails we should clarify which remote was used to fetch
from.
Copy link
Owner

@korthout korthout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙇 Sorry for taking so long. I was in the process of moving internationally. I'm trying to catch up again now.

❤️ Thanks for the amazing work on this! I love the solutions you found and I'm happy with the naming.

I've taken the liberty to adjust some last small things, but nothing major.

Let's merge this! 🚀 Please try it out in your repository and let me know if you run into any issues. In time, we can promote the inputs from their experimental status.

LGTM 👍

@korthout korthout merged commit 042b2d4 into korthout:main May 3, 2024
1 check passed
@korthout
Copy link
Owner

korthout commented May 3, 2024

To try this out you can either use:

  • korthout/backport@main
  • korthout/backport@042b2d4
  • korthout/backport@v2.next-preview

@mvayngrib
Copy link

nice, thank you guys!

Copy link

@mvayngrib mvayngrib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a few small suggestions

this.config.experimental.downstream_owner ?? undefined;
}

shouldUseDownstreamRepo(): boolean {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if this doesn't need to be used externally, better make it private

return !!this.downstreamRepo;
}

getRemote(): "downstream" | "origin" {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, could be private

@korthout korthout mentioned this pull request May 9, 2024
5 tasks
@korthout
Copy link
Owner

korthout commented May 9, 2024

Thanks for the notes @mvayngrib. I'd welcome any pull request with improvements 🙇

Did you already have a chance to try out this functionality? Any feedback is welcome.

@mvayngrib
Copy link

thanks @korthout, i haven't yet, but will share feedback when i do 👍

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.

ability to backport a PR to any repo, not necessarily a fork
3 participants