Skip to content

feat: auto-deepen shallow clones option#293

Open
bgalek wants to merge 1 commit intonebula-plugins:mainfrom
bgalek:main
Open

feat: auto-deepen shallow clones option#293
bgalek wants to merge 1 commit intonebula-plugins:mainfrom
bgalek:main

Conversation

@bgalek
Copy link
Copy Markdown

@bgalek bgalek commented Feb 25, 2026

Motivation

When using the plugin in GitHub Actions with shallow clones (e.g. default actions/checkout),
workflows currently need to set:

- uses: actions/checkout@v4
  with:
    fetch-depth: 0

Without a full git history, the plugin cannot discover existing version tags,
which results in falling back to the default development version.

To remove this requirement from CI workflows and make the plugin more robust in shallow environments,
this PR introduces an optional feature flag (nebula.release.features.unshallowEnabled) to automatically deepen the repository when needed.

When enabled:

  • The plugin detects if the repository is a shallow clone.
  • If shallow, it incrementally deepens the clone (git fetch --deepen) from origin.
  • It stops as soon as a version tag is discovered.

If no tag is found after the configured maximum iterations, it logs a warning and continues with existing behavior.
If the repository is not shallow → no change in behavior.
If the clone already contains the tag within the shallow depth → no deepening is performed.

I belive this solution can be set as default in the future!

@bgalek bgalek marked this pull request as ready for review April 1, 2026 08:37
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