Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Dec 29, 2025

Summary

Add dirty repository detection to craft publish to fail fast before any targets publish, matching the behavior of craft prepare. Previously, if the repo was dirty during publish, it would fail late in the process (after targets had already published) when handleReleaseBranch() tried to checkout, merge, and push.

Changes

  • Add shared isRepoDirty() utility function to src/utils/git.ts
  • Add --no-git-checks CLI option to publish command for backward compatibility
  • Add dirty repo check at the start of publishMain() before any git operations
  • Refactor prepare.ts to use the shared utility (reduces code duplication)
  • Add tests for the new isRepoDirty function

Fixes #265

Add dirty repository detection to `craft publish` to fail fast before
any targets publish, matching the behavior of `craft prepare`.

- Add shared `isRepoDirty` utility function to `src/utils/git.ts`
- Add `--no-git-checks` CLI option for backward compatibility
- Refactor `prepare.ts` to use the shared utility
- Add tests for the new utility function

Fixes #265
@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (changelog) Disable author mentions in PR preview comments by BYK in #684
  • (publish) Fail early on dirty git repository by BYK in #683

🤖 This preview updates automatically when you update the PR.

@BYK BYK marked this pull request as ready for review December 29, 2025 16:39
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.

Fail during post-release on dirty git repo

3 participants