Skip to content

Support ignoring branches #70

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

Merged
merged 1 commit into from
May 27, 2025
Merged

Support ignoring branches #70

merged 1 commit into from
May 27, 2025

Conversation

alcaeus
Copy link
Owner

@alcaeus alcaeus commented Mar 21, 2025

This PR adds support for the ignoredBranches input. This input takes a a list of ignored branch names as a JSON string. When getting candidates for the next branch name, any ignored branch is skipped until finding a non-skipped branch name. The tests contain examples for this.

Due to the way next branch candidates are computed, skipping the entirety of a major version leads to an unexpected result. Instead of targeting the first stable version of the major version after a skipped major, it targets the next dev branch of that major version. See the commented test for the expected behaviour. Fixing this would require changing how candidate branches are computed, and since this scenario is currently not needed by us, I'll wait with making the change.

@alcaeus alcaeus requested a review from Copilot March 21, 2025 13:09
@alcaeus alcaeus requested review from Copilot and removed request for Copilot March 24, 2025 07:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@alcaeus alcaeus requested a review from Copilot May 26, 2025 14:33
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for an ignoredBranches input to allow skipping specified branches when determining the next branch name. Key changes include wiring the new input through the Inputs class and action metadata, extending the Branch logic to filter out ignored branches, and expanding test coverage with various ignore scenarios.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main.ts Pass ignoredBranches into the Branch constructor
src/inputs.ts Parse and store the ignoredBranches action input
src/branch.ts Extend branch selection methods to skip ignored names
get-next-branch/action.yml Add ignoredBranches input definition
action.yml Add ignoredBranches input definition
tests/inputs.test.ts Update tests to assert ignoredBranches parsing
tests/branch.test.ts Add and adjust test cases covering ignore behavior
Comments suppressed due to low confidence (1)

tests/branch.test.ts:286

  • [nitpick] There's a noted TODO for handling cases where all branches of the next major version are ignored. Consider adding a test and implementing fallback logic to cover this scenario once the behavior is defined.
    // TODO: The following test fails as we don't try stable branches for future major versions

@alcaeus alcaeus merged commit c87b951 into main May 27, 2025
21 checks passed
@alcaeus alcaeus deleted the ignore-branches branch May 27, 2025 11:22
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.

1 participant