Exclude headref from selected branches #344
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request enables users to select target branches more leniently.
When the action is triggered for a pull request, its headref should not be selected as target branch because it already contains the commits. There is no use case to cherry-pick the changes to that same branch again. However, it was possible to select the headref both through labels matching the
labels_pattern
input, as well as through thetarget_branches
input. This pull request excludes the headref from any of the selected target branches automatically.One example where this could be useful was highlighted in #343. While glob patterns are not supported in the target_branches input yet, it is possible to expand a glob pattern in a separate step, like:
These branches can then be used as
target_branches
input. However, if the headref is among the selected branches, the action would unsuccessfully attempt to cherry-pick the changes of the pull request onto that same pull request's head. Git would rightfully complain about this. Now, that no longer occurs.closes #343