Skip to content

gh release create: Fail when there are no new commits since the most recent release #6059

Description

@sjackman

Describe the feature or problem you’d like to solve

Currently gh release create succeeds when there have been no new commits since the most recent release, creating a duplicate release. I would like gh release create to (optionally) fail when there have been no new commits since the most recent release.

Proposed solution

Add a new option that causes gh release create to fail when there have been no new commits since the most recent release.

Context

I created a duplicate release unintentionally when I hadn't noticed that there had been no new commits since the last release.

I now use a schedule GitHub action to create a new prerelease each night. It would create a duplicate release if there had been no new commits since the previous day.

Workaround

git fetch origin tag $(gh release list -L1 | cut -f1)
if git describe --tags --exact-match origin/master; then
  echo 'Error: No new commits since the most recent release'
  exit 1
else
  gh release create --prerelease --generate-notes $(date +%Y.%m.%d)
fi

Activity

  1. vilmibm commented on Aug 11, 2022

    @vilmibm
    Contributor

    I definitely see the merit in this; I can definitely think of times when someone might want to create a duplicate release -- to re-trigger an asset build, for example.

    I support adding a new flag to gh release create. Off the top of my head, --only-new, but I'm open to suggestion there.

    I'll open this up for a PR.

  2. added and removed on Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-releaserelating to the gh release commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions