Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Support multiple backports #4

Closed

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

$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.

@MSylvia MSylvia closed this Feb 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants