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

Backport script #1280

Merged
merged 2 commits into from
Mar 16, 2023
Merged

Backport script #1280

merged 2 commits into from
Mar 16, 2023

Conversation

lann
Copy link
Collaborator

@lann lann commented Mar 15, 2023

Also revert the workflow that doesn't work.

Usage:

.github/gh-backport.sh <PR #> <branch>

e.g.

$ .github/gh-backport.sh 1274 v1.0
Switched to a new branch 'backport-1274-to-v1.0'
Cherry picking commits...
[backport-1274-to-v1.0 b7c5007] fix wagi redirect status code
 Author: Rajat Jindal <[email protected]>
 Date: Wed Mar 15 23:09:39 2023 +0530
 1 file changed, 15 insertions(+), 8 deletions(-)
? Where should we push the 'backport-1274-to-v1.0' branch? lann/spin

Creating pull request for lann:backport-1274-to-v1.0 into main in fermyon/spin

remote: 
remote: 
To github.com:lann/spin.git
 * [new branch]      HEAD -> backport-1274-to-v1.0
branch 'backport-1274-to-v1.0' set up to track 'pub/backport-1274-to-v1.0'.
https://github.com/fermyon/spin/pull/1281

(which created #1281)

This reverts commit a5f3428.

This workflow doesn't work with mandatory commit signing.

Signed-off-by: Lann Martin <[email protected]>
@lann lann marked this pull request as draft March 15, 2023 21:59
@lann lann marked this pull request as ready for review March 15, 2023 22:03
@lann lann marked this pull request as draft March 15, 2023 22:10
This script semi-automates the process of backporting a PR from one
branch to another. Ex: `gh-backport.sh 123 v1.0`

Signed-off-by: Lann Martin <[email protected]>
@lann lann marked this pull request as ready for review March 15, 2023 22:21
Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

This worked well for me (#1284)! Though, I needed to do some setup (as a first time gh-user). Wonder if any/all of these should go in as script comments or a doc somewhere?

I needed:

  • gh auth login
  • gh repo set-default fermyon/spin
  • and I selected 'Create a fork of fermyon/spin' as the answer to the ? Where should we push the 'backport-1269-to-v1.0' branch? question (somewhat unintuitively; I already had a fork and indeed it just used vdice/spin).

@lann
Copy link
Collaborator Author

lann commented Mar 16, 2023

Yeah, this is definitely Minimum Viable Script here. I might turn it into a gh extension which I just learned exists: https://cli.github.com/manual/gh_extension

@itowlson
Copy link
Contributor

Oh, I didn't realise it depended on the user setting a default repo. (I didn't even know default repo was a thing.) Can't we just script it to use the Spin repo?

@rajatjindal
Copy link
Collaborator

can we use this script from within the Github actions? e.g. a workflow that run this script on a specific comment on the PR?

@lann
Copy link
Collaborator Author

lann commented Mar 16, 2023

The issue with doing this in a workflow is signing commits, just like the 3rd party action we tried.

@lann
Copy link
Collaborator Author

lann commented Mar 16, 2023

I'm going to merge since it seems to work. PRs welcome 🙂

@lann lann merged commit f95dbad into fermyon:main Mar 16, 2023
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.

4 participants