Skip to content

chore: add script for backporting#13952

Merged
shonfeder merged 1 commit intomainfrom
shonfeder/backport-script
Apr 2, 2026
Merged

chore: add script for backporting#13952
shonfeder merged 1 commit intomainfrom
shonfeder/backport-script

Conversation

@shonfeder
Copy link
Copy Markdown
Member

Adds a script to automate most of the work of backporting fixes. Makes the process less error prone, more uniform, and much quicker.

Signed-off-by: Shon Feder <shon.feder@gmail.com>
@shonfeder shonfeder requested a review from Sudha247 March 28, 2026 02:15
Copy link
Copy Markdown
Collaborator

@Sudha247 Sudha247 left a comment

Choose a reason for hiding this comment

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

LGTM! Some comments below, but I'm in favour of merging this and adding more improvements if needed, as we use it.

#
# Usage:
#
# $ VERSION=X.Y.Z PR=<pr-number> ./backport.sh
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be nice to have a real example here: something like (I'm making up the numbers)

$ VERSION=3.22.0 PR=#13472

I realized only later in the script that this version does not include rc, which is clear in hindsight, and the description below also helps.

# Validate and prepare input variables
[ ! -z "${PR}" ] || (echo >&2 "error: variable 'PR' is not set"; exit 1)
[ ! -z "${VERSION}" ] || (echo >&2 "error: variable 'VERSION' is not set"; exit 1)
PR_ONLY=${PR_ONLY:-false}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Moving this block before checking for utils would fail faster if the variables are not set. Either way doesn't matter too much.

rc_branch="${VERSION}-rc"
backport_branch="backport-${PR}"

configured_remote=$(git config remote.pushdefault || echo "")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is worth documenting, I think! What origin means depends on the user.. are we assuming origin here is ocaml/dune, or the user's personal fork? (I reckon it's the former)

@shonfeder
Copy link
Copy Markdown
Member Author

Thanks for the review! Good suggestions that we should indeed incorporate in follow-ups. :)

@shonfeder shonfeder merged commit 5ab813f into main Apr 2, 2026
29 checks passed
@shonfeder shonfeder deleted the shonfeder/backport-script branch April 2, 2026 19:28
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