Skip to content
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

[gh release create] Fail when there are no new commits since the last release #10398

Merged
merged 4 commits into from
Feb 19, 2025

Conversation

iamazeem
Copy link
Contributor

@iamazeem iamazeem commented Feb 8, 2025

Fixes #6059.

Introduce a new Boolean flag --only-new (--fail-on-no-commits) to create release only if new commits exist since the last release.
Only the latest published release is checked. The draft and pre-release releases are excluded.

APIs Used

Tests Cases

  1. New commits exist but no published release exists - release created (exit code 0)
  2. New commits exist and the last release exists too - release created (exit code 0)
  3. No new commits exist but the last release exists - release not created (exit code 1)

Test Runs

# Test cases 1 and 2
$ bin/gh release create --repo iamazeem/test --fail-on-no-commits --generate-notes v1.2.3
https://github.com/iamazeem/test/releases/tag/v1.2.3

# Test case 3 (exit code 1)
$ bin/gh release create --repo iamazeem/test `--fail-on-no-commits` --generate-notes v1.2.3
no new commits since the last release

UPDATE

During review discussions, the flag has been renamed to --fail-on-no-commits.

@iamazeem iamazeem requested a review from a team as a code owner February 8, 2025 13:46
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Feb 8, 2025
Copy link
Member

@williammartin williammartin left a comment

Choose a reason for hiding this comment

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

Lots of good stuff in this PR thank you. Couple of notes.

@williammartin
Copy link
Member

One minor error change, and then I'm happy to ship this, thanks.

Copy link
Member

@williammartin williammartin left a comment

Choose a reason for hiding this comment

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

Looks great to me thanks!

@williammartin williammartin merged commit 1710f7d into cli:trunk Feb 19, 2025
9 checks passed
@iamazeem iamazeem deleted the 6059-gh-release-create-only-new branch February 19, 2025 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external pull request originating outside of the CLI core team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gh release create: Fail when there are no new commits since the most recent release
3 participants