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

Support multiple backports #4

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mandel-macaque
Copy link
Member

When working in large projects with more than one release branch the old
code made us write a comment PER branch, resulting in something like:

/sudo backport d16-9
/sudo backport xcode12.4
/sudo backport xcode12.5

That is a lot of work and developers are lazy animals. We already
supported using more than one branch in the regexp but it resulted in an
error later in the script. This commit makes the required changes to
ensure that we support several branches.

  1. Parses all branches, creates a collection in the params.
  2. If only one branch is used, we create a collection with a single
    object, else several.
  3. We trigger a backport PER branch in a loop using a scriptblock.
  4. The exit code is the addition of all the exit codes, resulting in 0
    if all worked or the number of errors.

When working in large projects with more than one release branch the old
code made us write a comment PER branch, resulting in something like:

/sudo backport d16-9
/sudo backport xcode12.4
/sudo backport xcode12.5

That is a lot of work and developers are lazy animals. We already
supported using more than one branch in the regexp but it resulted in an
error later in the script. This commit makes the required changes to
ensure that we support several branches.

1. Pares all branches, creates a collection in the params.
2. If only one branhc is used, we create a collection with a single
   object, else several.
3. We trigger a backport PER branch in a loop using a scriptblock.
4. The exit code is the addition of all the execitions, resulting in 0
   if all worked or the number of errors.
action.yml Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
action.yml Outdated

$parameters = @()

if ($backportTargetBranch.GetType().Name -eq "String") { # uh, this is ugly, but String also has length and we can iterate, so we need the type
Copy link

@Therzok Therzok Feb 5, 2021

Choose a reason for hiding this comment

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

Can't we use $backportTargetBranch -is [string] instead?

Right now, MyLib.String also matches.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not a pwsh person ;) looks better, let me test

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated, works like a charm.

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